Maven工程改造中如果实在脱离不开对于Ant 的依赖,这样做:
view plaincopy to clipboardprint?
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>2.1</version>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.7.1</version>
</dependency>
<!-- ...其它包依赖 -->
</dependencies>
<executions>
<execution>
<id>ant-test</id>
<phase>package</phase>
<configuration>
<tasks>
<!-- 下面可以传入一些Maven变量 -->
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>
<ant antfile="${basedir}/build.xml"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- ... -->
<plugins>
</build>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>2.1</version>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.7.1</version>
</dependency>
<!-- ...其它包依赖 -->
</dependencies>
<executions>
<execution>
<id>ant-test</id>
<phase>package</phase>
<configuration>
<tasks>
<!-- 下面可以传入一些Maven变量 -->
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>
<ant antfile="${basedir}/build.xml"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- ... -->
<plugins>
</build>
本文转自胡奇 51CTO博客,原文链接:http://blog.51cto.com/huqicto/280889,如需转载请自行联系原作者