ANT war task fails with strange error message
I am trying to create a war file out of an eclipse project using ant The responsible ant target looks like this
<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>
And it fails with the following error: F:\eclipse_workspaces\skyeye\railWeb\build.xml:35: Syntax error in property: ??? ???i8?
Google search turned up only this: 开发者_运维技巧http://209.85.135.132/search?q=cache:OrmNOY9EJd0J:teamcity.jetbrains.com/viewLog.html%3Bjsessionid%3D114D52086BAE423B2F69A99B4CFACACD%3FbuildId%3D29573%26tab%3DbuildChangesDiv%26buildTypeId%3Dbt134+ant+war+task+%22Syntax+error+in+property%22&cd=1&hl=en&ct=clnk&client=firefox-a
Can anybody explain, what the heck is going on?
The propblem was that I used 'excludesFile' assuming it would exclude a single file. Instead ANT tried to parse it as an property file which gets difficult since it actually was a jar file.
The correct way to exclude a jar file is given in the documentation. If anyone face same issue, they can refer to this link.
This example is taken from the documentation, here we are removing jdbc1.jar
from 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
精彩评论