Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ANT war任务失败,并显示奇怪的错误消息_Ant_Properties_War - Fatal编程技术网

ANT war任务失败,并显示奇怪的错误消息

ANT war任务失败,并显示奇怪的错误消息,ant,properties,war,Ant,Properties,War,我正在尝试使用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

我正在尝试使用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\U Workspace\skyeye\railWeb\build.xml:35:属性中的语法错误:???i8? 谷歌搜索仅显示以下内容:


谁能解释一下,到底发生了什么事?

问题是我使用了“excludesFile”,假设它会排除单个文件。相反,ANT试图将其解析为属性文件,这变得很困难,因为它实际上是一个jar文件。

中给出了排除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
在项目的基本目录中采用以下结构:
第三方/libs/jdbc1.jar
第三方/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
然后使用创建war文件myapp.war
将包括
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
image/small/logo.gif
image/large/logo.gif

我遇到以下问题:build.xml:1139:属性中的语法错误:${��.是的,这一切都是由于使用了
excludesFile
。现在我只是远离
excludesFile