【发布时间】:2011-01-18 12:25:13
【问题描述】:
我的 maven java 项目使用 maven-antrun-plugin 来执行部署我的应用程序的 deploy.xml ant 脚本。 deploy.xml 使用<if> 任务,这似乎是导致问题的原因;
[INFO] 执行任务
[taskdef] 无法从资源 net/sf/antcontrib/antlib.xml 加载定义。找不到。部署:
[信息] --------------------------------------------- -------------------------
[错误] 构建错误
[信息] --------------------------------------------- -------------------------
[INFO] 发生 Ant BuildException:执行此行时发生以下错误:
E:\My_Workspace\xxxxxx\xxxxxx\xxxxxxx\deploy.xml:24:问题:无法创建任务或键入 if
原因:名称未定义。
行动:检查拼写。
行动:检查是否已声明任何自定义任务/类型。
行动:检查任何/ 声明已经发生。
这是我的 pom 中的 antrun 插件配置;
<plugin>
<inherited>false</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>remote-deploy</id>
<phase>install</phase>
<configuration>
<tasks>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath"/>
<property name="compile_classpath" refid="maven.compile.classpath" />
<property name="runtime_classpath" refid="maven.runtime.classpath" />
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<echo message="compile classpath: ${compile_classpath}"/>
<echo message="runtime classpath: ${runtime_classpath}"/>
<echo message="plugin classpath: ${plugin_classpath}"/>
<ant antfile="${basedir}/deploy.xml">
<target name="deploy" />
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
</plugin>
.. 这是我的 deploy.xml 中的相关部分;
<target name="deploy" if="deploy">
<if> <!-- line 24 -->
<and>
为什么我查看我的 maven repo 我可以看到 ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar 而当我查看 jar 里面时我可以看到 net/sf/antcontrib/antcontrib.properties 所以那里没问题。
当我检查maven.compile.classpath、maven.compile.classpath 和maven.compile.classpath 的值时,我看不到对antcontrib 的任何引用,这可能是问题所在吗?为什么 antcontrib 被定义为依赖时它们不出现?
【问题讨论】:
标签: java maven ant-contrib maven-antrun-plugin