Maven-antrun-plugin失败:无法从资源project.properties加载定义。它无法找到

时间:2014-09-26 21:35:49

标签: java maven ant maven-antrun-plugin

上下文: 我正在尝试在编译期间构建一个web.xml。我使用ant脚本来执行此任务。 ant脚本使用属性文件中定义的属性来完成此任务。

使用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}是属性文件中定义的


MAVEN 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> 

我做错了吗?

提前致谢

1 个答案:

答案 0 :(得分:0)

如果将project.properties文件存储在build / ant /目录中,则ant不知道在那里搜索它。此外,而不是使用taskdef:

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

在我的本地机器上工作。

以下是详细文档:

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

相关问题