BustedSanta BustedSanta - 22 days ago 6
Java Question

Failed Ant build - The libs.CopyLibs.classpath property is not set up

I am trying to create a .war file from a svn source code that appears to be built using NetBeans.

I am aware of the question The libs.CopyLibs.classpath property is not set up

However, I would like to provide further details about my setup and the answers in the other question don't resolve my issue.

I am using Eclipse Luna & Ant version apache-ant-1.9.4. Could someone please enlightenment me whether I actually need the file and if so why? I downloaded the missing jar and the title of the jar is "org-netbeans-modules-java-j2seproject-copylibstask.jar" which suggests to me that this jar is IDE-specific. Just making an assumption here.

Here's my error message that I receive in a command prompt on running "ant" command.


BUILD FAILED
C:\eclipse_workspace\MyProject\xyz\project\build-impl.xml:476:
The libs.CopyLibs.classpath property is not This property must point to org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at /java/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar


I can see that message is coming from my "build-impl.xml" file. But I don't really understand the purpose of the file and how to resolve this issue since I don't even have Netbeans installed on my machine.

<target name="-init-taskdefs">
<fail unless="libs.CopyLibs.classpath">
The libs.CopyLibs.classpath property is not set up.
This property must point to org-netbeans-modules-java-j2seproject-copylibstask.jar
file which is part of NetBeans IDE installation and is usually located at
&lt;netbeans_installation&gt;/java&lt;version&gt;/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library exists or setup the
property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar
</fail>
<taskdef classpath="${libs.CopyLibs.classpath}"
resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/>
</target>

Answer

I have managed to find a working solution for my situation.

1) Downloaded and added the org-netbeans-modules-java-j2seproject-copylibstask.jar to my Ant/lib directory: C:/apache-ant-1.9.4/lib/

2) (in command line) Navigated to the folder containing my "build.xml" file, so it would be "abcfolder" C:\eclipse_workspace\myproject\abcfolder\build.xml

3) Ran the following commmand ant -Dlibs.CopyLibs.classpath=C:/apache-ant-1.9.4/lib/org-netbeans-modules-java-j2seproject-copylibstask.jar

I got a successful build.