简体   繁体   中英

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>

Using NetBeans, You can resolve this problem using these steps:

In NetBeans, select Tools > Options > Miscellaneous > Ant .

In the Properties section, add the following property:

libs.CopyLibs.classpath=/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar

/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar must be your org-netbeans-modules-java-j2seproject-copylibstask.jar file path

只需调用Netbeans频繁更新(帮助->检查更新)就可以在我的PC上解决此问题(使用NetBeans 8.0.2)

checked for updates in netbeans(Help --> Check for Updates) and the problem got solved. This solved my problem...... Earlier i was thinking to re-install netbeans, but being a lenghty process I decided to search for the solution and luckily found the solution. Guys every prob has a solution, try to get the solution in your way.....

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.

I updated the build.xml file and it worked

<target name="-init-taskdefs">
<property name="libs.CopyLibs.classpath" value="(path of netbeans 
folder)/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar"/>
<fail unless="libs.CopyLibs.classpath">    

thank you, for referring this

If you get "

Could not load definitions from resource org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml. It could not be found.

" this error after setting Tools > Options > Miscellaneous > Ant in the Properties , adding property-

libs.CopyLibs.classpath=/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar

Then add jar in the upper field "Classpath" add this "org-netbeans-modules-java-j2seproject-copylibstask.jar" jar located in your netbeans installation location inside "NetBeans 8.0.2\\extide\\ant\\extra".

For the main answer the setting in Netbeans. You may find is in Tools > Options > Java > Ant

And it may be easier to click Add Directory next to the Classpath window and navigate to the ...\\java\\ant\\extra to add that whole folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM