我如何把一个Ant路径转换文件集? [英] How do I convert an Ant Path into a FileSet?
问题描述
我在写一个Ant脚本打包项目到WAR文件。该软件由自己的源目录,图书馆等几个项目。
战争任务都有一个嵌套元素 LIB
这我目前工作的。我现在有一个路径所需的库的参考
(包含几个文件集
,这是我在类路径参考使用该 LIB
,但希望输入的A 文件集
,并拒绝一个路径
。
我想转换我的路径
到文件集
,但当时我并没有把它作为一个工作类路径在其他地方。
有没有办法到路径
转换成文件集
?我不想复制粘贴的目录。
<路径ID =compile.libs>
<文件集DIR =$ {} common.path / lib目录包括=*罐子。/>
<文件集DIR =$ {} data.path / lib目录包括=*罐子。/>
<文件集DIR =$ {} gui.path / lib目录包括=*罐子。/>
<文件集DIR =$ {} gui.path /的WebContent / WEB-INF / lib目录包括=*罐子/>
< /路径>
...与中所使用的时候,战争..>< ../& GT; < LIB REFID =compile.libs/> < /战争>
引出:
构建失败
的build.xml:173:compile.libs不表示zipfileset或文件集
您可以有多种选择。
- 您可以提供多个
<&LIB GT;
嵌套元素<战争与GT;
任务。也许这将是足够的。 - 您可以preassemble所有的
LIB
在一个临时文件
目录,然后只是引用
目录作为文件集。 - 有一个蚂蚁的contrib
PathToFileSet 的任务,但它
需要一个中央根目录下,
而这可能不符合的情况下的compile.libs
布局。 - 由于蚂蚁1.8.0可以使用 mappedresources 。来源:<一个href=\"http://stackoverflow.com/questions/5039505/ant-script-$p$pvent-duplication-of-jar-in-javac-classpath-war-lib\">Ant脚本:在javac的类路径战争LIB JAR的prevent重复
我想我会尝试选项1。
I'm writing an Ant script to package a project into a WAR file. The software consists of several projects with their own source directories, libraries, etc.
The WAR task has a nested element lib
which I'm currently working on. I currently have a reference of the required libs as a Path
(containing several FileSets
, which I use in a classpath reference. The lib
, however, wants the input to be a FileSet
, and it refuses a Path
.
I tried converting my Path
into a FileSet
, but then I didn't get it to work as a classpath elsewhere.
Is there a way to convert a Path
into a FileSet
? I would hate to copy-paste the directories.
<path id="compile.libs">
<fileset dir="${common.path}/lib" includes="*.jar"/>
<fileset dir="${data.path}/lib" includes="*.jar"/>
<fileset dir="${gui.path}/lib" includes="*.jar"/>
<fileset dir="${gui.path}/WebContent/WEB-INF/lib" includes="*.jar"/>
</path>
...when used with <war ..><../> <lib refid="compile.libs"/> </war>
leads to:
BUILD FAILED build.xml:173: compile.libs doesn't denote a zipfileset or a fileset
You may have several choices.
- You may provide more than one
<lib>
nested element to<war>
task. Maybe this would be enough. - You may preassemble all of your
lib
files in one temporary directory and then just reference that directory as a fileset. - There is an ant-contrib
PathToFileSet task, but it
requires a central root directory,
and this may not be a case with your
compile.libs
layout. - Since Ant 1.8.0 you can use a mappedresources. Source: Ant script: Prevent duplication of JAR in javac-classpath war-lib
I think I would try option 1.
这篇关于我如何把一个Ant路径转换文件集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!