Qwe*_*rky 15 java ant-contrib maven maven-antrun-plugin
我的maven java项目使用maven-antrun-plugin来执行部署我的应用程序的deploy.xml ant脚本.deploy.xml使用该<if>任务,这似乎导致了问题;
[INFO]执行任务
[taskdef]无法从资源net/sf/antcontrib/antlib.xml加载定义.它无法找到.部署:
[INFO] --------------------------------------------- ---------------------------
[ERROR] BUILD ERROR
[INFO] --------------- -------------------------------------------------- -------
[INFO]发生了Ant BuildException:执行此行时发生以下错误:
E:\ My_Workspace\xxxxxx\xxxxxx\xxxxxxx\deploy.xml:24:问题:创建任务或类型失败如果
原因:名称未定义.
行动:检查拼写.
操作:检查是否已声明任何自定义任务/类型.
操作:检查是否已发生任何<presetdef>/<macrodef>声明.
这是我的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>
Run Code Online (Sandbox Code Playgroud)
..这是我的deploy.xml中的相关部分;
<target name="deploy" if="deploy">
<if> <!-- line 24 -->
<and>
Run Code Online (Sandbox Code Playgroud)
为什么我看看我能看到的maven回购ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar,当我看到罐子里面时,我可以看到net/sf/antcontrib/antcontrib.properties那里没问题.
当我检查的数值maven.compile.classpath,maven.compile.classpath而maven.compile.classpath我看不到任何引用antcontrib,这会是什么问题?当它antcontrib被定义为依赖时,它们为什么不出现?
Vas*_*kin 26
我认为为了运行maven插件而将ant添加到编译类路径中并不是一个好主意.
我使用Maven 3.0.4并通过为ant-contrib标记指定名称空间来工作,例如:
<configuration>
<target>
<echo message="The first five letters of the alphabet are:"/>
<ac:for list="a,b,c,d,e" param="letter" xmlns:ac="antlib:net.sf.antcontrib">
<sequential>
<echo>Letter @{letter}</echo>
</sequential>
</ac:for>
</target>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我的maven-antrun-plugin依赖:
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b3</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
好的,我已经解决了。
将依赖项从标签中移出<build><plugin>并将它们与其他项目依赖项一起放入似乎已经成功了。
| 归档时间: |
|
| 查看次数: |
19076 次 |
| 最近记录: |