Ant 将类路径 jar 复制到目录
我确信这个问题之前已经被问过或者非常简单。但无论出于何种原因,我似乎无法让它发挥作用。我想使用 ant 将 ${build.classpath}
(其中包含冒号分隔的 jar 列表)复制到 ${output.dir}/myapp/WEB-INF/lib
。
我现在有这个,但它似乎不起作用:
<copy toDir="${output.dir}/myapp/WEB-INF/lib">
<fileset file="${build.classpath}" />
</copy>
它将整个类路径视为一个文件。我该如何让它发挥作用?
I'm sure this has either been asked before or is pretty straightforward. But for whatever reason, I cannot seem to make it work. I want to use ant to copy the ${build.classpath}
(which contains a colon separated list of jars) to the ${output.dir}/myapp/WEB-INF/lib
.
I have this right now and it doesn't seem to work:
<copy toDir="${output.dir}/myapp/WEB-INF/lib">
<fileset file="${build.classpath}" />
</copy>
It treats the whole classpath as one file. How do I get this to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
关于复制任务的 Ant 手册包含您问题的答案。它提供的示例片段之一:
The Ant Manual on the copy task contains the answer for your problem. One of the example snippets it provides:
我认为这样的想法应该可行:
或者在包含中使用通配符:
I think somethink like this should work:
or with wildcard in include:
<include name="**/*.jar" />
我认为你应该将所有冒号分隔的 jar 文件放在一个根文件夹中。如果不可能,则创建一个单独的任务,将这些 jar 文件放入一个文件夹中(可能是临时的)。并将
${build.classpath}
分配给该文件夹。在复制子句中使用
。我希望,它应该有所帮助。
I think you should put all your colon separated jar files to one root folder. If it is not possible then create a separate task that put those jar files into one folder(may be temporary). And assign
${build.classpath}
to that folder. Use<fileset dir="${build.classpath}"/>
in your copy clause.I hope, it should help.