title: Why can't NetBeans find CopyLibs for some of my projects?
body: <p>I ran into a nasty issue this morning that cost me several hours trying to trace it down. I had inherited some code with two NetBeans projects, <code>A</code> and <code>B</code>. <em>They both build and run successfully</em>; there are no complicated Ant build tasks; just the default IDE setup.</p>
  
  <p>These two projects share a large amount of code, so I factored it out into a new, third project, <code>Common</code>. After resolving references and so on, NetBeans reports no errors. Everything seems fine. I build the <code>Common</code> project without a hitch. Then things get weird.</p>
  
  <p>Suddenly, when I try to build projects <code>A</code> and <code>B</code>, they <em>compile</em> just fine--but at the end of the <em>build</em>, each one breaks with the same error:</p>
  
  <pre><code>Copying 1 file to C:\Projects\projectName\build
  C:\Projects\projectName\nbproject\build-impl.xml:723: The following error occurred while executing this line:
  C:\Projects\projectName\nbproject\build-impl.xml:543: taskdef class org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs cannot be found
   using the classloader AntClassLoader[]
  BUILD FAILED (total time: 3 seconds)
  </code></pre>
  
  <p>All the <code>.class</code> files show up in <code>build/classes</code>, and everything else seems to have gone smoothly, but nothing makes it to the <code>dist</code> folder. So begins my search for <code>CopyLibs</code> issues.</p>
  
  <p>People suggested making sure that <code>org-netbeans-modules-java-j2seproject-copylibstask.jar</code> was referenced correctly in the <code>project.properties</code> file (it was), and in the <code>&lt;userhome&gt;/.netbeans/version/build.properties</code> file as well (it was). The library <em>does</em> exist at all the places it is referenced; in fact NetBeans seems to place a copy of this jar into the <code>./lib</code> folder of all Java projects by default. I tried making brand-new projects and bringing the sources in manually, to no avail. I was mystified.</p>
  
  <p>I'm posting here in the hopes that:</p>
  
  <ul>
  <li>Maybe someone can give me some insight into <strong>how this happened in the first place and how to avoid it.</strong></li>
  <li>Maybe someone can tell me <strong>why only certain projects break</strong>, even when all have exactly the same <code>project.properties</code> file or are brand new.</li>
  <li>People with this problem in the future will have a better time of it.</li>
  </ul>