java 如何在类路径中为 ant 脚本添加一个文件夹?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3986565/
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
How to add one folder in classpath for ant script?
提问by M.J.
I need to add a folder in current classpath for ant script that I have written for running java files. How can it be done?
我需要在当前类路径中为我为运行 java 文件编写的 ant 脚本添加一个文件夹。怎么做到呢?
采纳答案by M.J.
i added the following line in the tag of the task and it ran successfully.
我在任务的标签中添加了以下行并且它运行成功。
<pathelement path="C:\JunitTest\folderIsHere"/>
and after this the script ran successfully.
在此之后,脚本成功运行。
回答by aioobe
You could add it as an attribute
您可以将其添加为属性
<java classpath="${extraDir}"
classname="pkg.Class">
...
</java>
Or using the nested <classpath>
tag:
或者使用嵌套<classpath>
标签:
<java classname="pkg.Class">
<classpath>
<pathelement path="${extraDir}"/>
</classpath>
</java>
See the documentation for the Java task.
请参阅Java 任务的文档。