eclipse 失败的 Ant 构建 - 未设置 libs.CopyLibs.classpath 属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26046676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed Ant build - The libs.CopyLibs.classpath property is not set up
提问by BustedSanta
I am trying to create a .war file from a svn source code that appears to be built using NetBeans.
我正在尝试从似乎是使用 NetBeans 构建的 svn 源代码创建一个 .war 文件。
I am aware of the question The libs.CopyLibs.classpath property is not set up
我知道这个问题未设置 libs.CopyLibs.classpath 属性
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.
我正在使用 Eclipse Luna & Ant 版本 apache-ant-1.9.4。有人可以启发我是否真的需要该文件,如果需要,为什么?我下载了丢失的 jar 并且 jar 的标题是“org-netbeans-modules-java-j2seproject-copylibstask.jar”,这表明这个 jar 是特定于 IDE 的。这里只是做个假设。
Here's my error message that I receive in a command prompt on running "ant" command.
这是我在运行“ant”命令时在命令提示符中收到的错误消息。
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
构建失败 C:\eclipse_workspace\MyProject\xyz\project\build-impl.xml:476: The libs.CopyLibs.classpath 属性不是这个属性必须指向 org-netbeans-modules-java-j2seproject-copylibstask.jar 文件是 NetBeans IDE 安装的一部分,通常位于 /java/ant/extra 文件夹中。在 IDE 中打开项目并确保 CopyLibs 库存在或手动设置属性。例如像这样: 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.
我可以看到该消息来自我的“build-impl.xml”文件。但是我真的不明白该文件的用途以及如何解决这个问题,因为我的机器上甚至没有安装 Netbeans。
<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
<netbeans_installation>/java<version>/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>
采纳答案by BustedSanta
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/
1) 下载并添加 org-netbeans-modules-java-j2seproject-copylibstask.jar 到我的 Ant/lib 目录: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
2)(在命令行中)导航到包含我的“build.xml”文件的文件夹,所以它将是“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
3)运行以下命令 ant -Dlibs.CopyLibs.classpath=C:/apache-ant-1.9.4/lib/org-netbeans-modules-java-j2seproject-copylibstask.jar
I got a successful build.
我得到了一个成功的构建。
回答by sunil kumar
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.....
检查 netbeans 中的更新(帮助 --> 检查更新),问题得到解决。这解决了我的问题......早些时候我想重新安装netbeans,但由于一个漫长的过程,我决定寻找解决方案并幸运地找到了解决方案。伙计们,每个问题都有一个解决方案,尝试以您的方式获得解决方案.....
回答by AndreS
simply only a call of the netbeans frequently updates (Help --> Check for Updates) solved this problem on my PC (using NetBeans 8.0.2)
只需调用 netbeans 频繁更新(帮助 --> 检查更新)即可在我的 PC 上解决此问题(使用 NetBeans 8.0.2)
回答by user8411823
I updated the build.xml file and it worked
我更新了 build.xml 文件并且它起作用了
<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
谢谢你,参考这个
回答by Saranga kapilarathna
Using NetBeans, You can resolve this problem using these steps:
使用 NetBeans,您可以使用以下步骤解决此问题:
In NetBeans, select Tools > Options > Miscellaneous > Ant
.
在 NetBeans 中,选择Tools > Options > Miscellaneous > Ant
。
In the Properties
section, add the following property:
在该Properties
部分中,添加以下属性:
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
/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
必须是你的org-netbeans-modules-java-j2seproject-copylibstask.jar
文件路径
回答by Subhajit
If you get "
如果你得到 ”
Could not load definitions from resource org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml. It could not be found.
无法从资源 org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml 加载定义。无法找到。
" this error after setting Tools > Options > Miscellaneous > Ant in the Properties , adding property-
" 在 Properties 中设置 Tools > Options > Miscellaneous > Ant 后出现此错误,添加属性-
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".
然后在上面的字段“类路径”中添加 jar 将这个“org-netbeans-modules-java-j2seproject-copylibstask.jar”jar 添加到位于“NetBeans 8.0.2\extide\ant\extra”内的 netbeans 安装位置。
回答by Neil
For the main answer the setting in Netbeans. You may find is in Tools > Options > Java> Ant
对于主要答案 Netbeans 中的设置。您可能会在工具 > 选项 > Java> Ant 中找到
And it may be easier to click Add Directory next to the Classpath window and navigate to the ...\java\ant\extrato add that whole folder.
单击 Classpath 窗口旁边的 Add Directory 并导航到...\java\ant\extra以添加整个文件夹可能会更容易。