如何使用Maven v。2.x打包Ant v.1.8.1版本?
问题描述:
我需要使用子项目来构建项目,而主项目是Maven项目,其中一个子项目 - 是Ant项目。 我需要编译一个主要pom.xml中的所有项目 我找到了解决方案How to wrap an Ant build with Maven?,它的答案是正确的,但不适合我的项目。因为当我需要蚂蚁项目的Ant诉1.8.x的,但在与如何使用Maven v。2.x打包Ant v.1.8.1版本?
<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>
<modules>
<module>Bundles/I_AboutForm</module>
<module>Bundles/I_AppVars</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<!--<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="maven.plugin.classpath" />-->
<tasks>
<ant antfile="MainApplication/build.xml" target="compile"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Maven构建下载蚂蚁诉1.7.1,并使用他的版本(在当地回购有Ant v.1.8.1 )。 我认为,在ant-contrib 1.0b3的依赖中可能会遇到麻烦 - 可能是ant-contrib依赖于Ant v。1.7.1吗?
请指教我如何在Maven中构建Ant v。1.8.x项目。 谢谢,最好的问候,亚瑟。
答
看着插件1.7的版本,它似乎使用ant版本1.8.2 http://maven.apache.org/plugins/maven-antrun-plugin/dependencies.html
试图指定插件的maven-antrun-插件
例如1.7版本:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>