更新时间:2023-09-17 21:04:16
使用Maven的蚂蚁亚军插件来调用Ant的逻辑,使用Ant的 subant 任务
Use the Maven ant runner plugin to invoke the ANT logic, using ANT's subant task
$ tree
.
|-- pom.xml
`-- src
`-- main
`-- ant
|-- module1
| `-- build.xml
`-- module2
`-- build.xml
5 directories, 3 files
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.myspotontheweb.demo</groupId>
<artifactId>demo</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<target>
<property name="src.dir" location="${project.build.directory}/../src"/>
<subant>
<fileset dir="${src.dir}" includes="**/build.xml"/>
</subant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
ANT配置在Maven构建的编译阶段运行。蚂蚁逻辑使用 subant 任务运行外部ANT逻辑。
ANT is configured to run during the "compile" phase of the Maven build. The ANT logic uses the subant task to run external ANT logic.
$ mvn compile
..
..
[INFO] --- maven-antrun-plugin:1.7:run (default) @ demo ---
[INFO] Executing tasks
main:
main:
[echo] module1: hello world
main:
[echo] module2: hello world
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.394s
[INFO] Finished at: Fri Apr 27 20:25:35 IST 2012
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------