我正在尝试使用ant从eclipse项目中创建一个war文件 负责任的蚂蚁目标看起来像这样
<target name="jar" depends="build" description="Erzeugt das WAR File">
<war destfile="${project.dir.dist}/xyz.jar" webxml="${basedir}/WebRoot/WEB-INF/web.xml" duplicate="fail" basedir="${basedir}">
<lib dir="${project.dir.dist}" excludesfile="${project.dir.dist}/xyz.jar" />
<classes dir="${project.dir.bin}" />
<webinf dir="${basedir}/WebRoot/WEB-INF" excludes="*.class" />
<metainf dir="${basedir}/WebRoot/META-INF" />
</war>
</target>
它失败并出现以下错误: F:\ eclipse_workspaces \ skyeye \ railWeb \ build.xml:35:属性中的语法错误:??? ??? I8?
任何人都能解释一下,到底发生了什么事?
答案 0 :(得分:7)
问题是我使用'excludesFile'假设它会排除单个文件。相反,ANT试图将其解析为属性文件,因为它实际上是一个jar文件而变得困难。
答案 1 :(得分:1)
documentation中给出了排除jar文件的正确方法。如果有人遇到同样的问题,他们可以参考这个链接。
此示例摘自文档,此处我们从jdbc1.jar
lib
Assume the following structure in the project's base directory:
thirdparty/libs/jdbc1.jar
thirdparty/libs/jdbc2.jar
build/main/com/myco/myapp/Servlet.class
src/metadata/myapp.xml
src/html/myapp/index.html
src/jsp/myapp/front.jsp
src/graphics/images/gifs/small/logo.gif
src/graphics/images/gifs/large/logo.gif
then the war file myapp.war created with
<war destfile="myapp.war" webxml="src/metadata/myapp.xml">
<fileset dir="src/html/myapp"/>
<fileset dir="src/jsp/myapp"/>
<lib dir="thirdparty/libs">
<exclude name="jdbc1.jar"/>
</lib>
<classes dir="build/main"/>
<zipfileset dir="src/graphics/images/gifs"
prefix="images"/>
</war>
will consist of
WEB-INF/web.xml
WEB-INF/lib/jdbc2.jar
WEB-INF/classes/com/myco/myapp/Servlet.class
META-INF/MANIFEST.MF
index.html
front.jsp
images/small/logo.gif
images/large/logo.gif