2014-09-26 194 views
0

上下文: 我正在编译期间尝试构建web.xml。我使用ant脚本来执行此任务。 ant脚本使用属性文件中定义的属性来完成此任务。Maven-antrun-plugin失败:无法从资源project.properties加载定义。无法找到

使用Maven-ant-plugin调用ant脚本。

但是,当我做一个maven构建。它失败,并显示消息“An Ant BuildException 无法从资源project.properties加载定义,无法找到它。”

Ant脚本看起来象下面这样:



<project name="xyz" basedir="." default="make_webxml"> 
<target name="make_webxml"> 
<taskdef resource="project.properties"/> 
<echo file="${webappdir}/web.xml"> 
<> 
<> 
</target> 
</project> 


$ {} webappdir在属性文件中定义


MAVE ñPOM:

<plugin> 
    <artifactId>maven-antrun-plugin</artifactId> 
    <executions> 
    <execution> 
     <phase>process-resources</phase> 
     <configuration> 
     <target> 
     <ant dir="build/ant/" /> 
     </target> 
     <tasks> 
       <ant antfile="build/ant/bld_webxml.xml" target="make_webxml"/> 
     </tasks> 
     </configuration> 
     <goals> 
     <goal>run</goal> 
     </goals> 
    </execution> 
    </executions> 
    </plugin> 

难道我做错了什么?

在此先感谢

回答

0

如果存储编译/蚂蚁/蚂蚁目录内的project.properties文件不知道到那里寻找它。此外,而不是taskdef使用:

<property file="build/ant/project.properties"/> 

在我的本地机器上工作。

下面是详细的文档:

http://ant.apache.org/manual/Tasks/property.html

+0

谢谢彼得,但我尝试这样做,也试图提供对属性文件的完整路径。它仍然会给出同样的错误。欢迎提供更多建议。 – maverick4084716 2014-09-29 15:48:39

+0

我刚刚编辑了我的评论。我测试了它,并从build/ant目录下的project.properties文件包含在ant build中。 – 2014-09-29 18:26:51