【发布时间】:2013-04-17 09:18:26
【问题描述】:
如何在多个项目中重复使用 ant sn-p?假设我的根 pom.xml 中有以下内容:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>gen-index</id>
<phase>package</phase>
<configuration>
<target>
... some non-trivial ant stuff here ...
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
<execution>
</executions>
</plugin>
如何让这个 ant sn-p 为选定的子项目执行?我已经尝试将上面的<plugin>...</plugin> 部分添加到<pluginManagement>...,但我不知道如何指定应该为哪些子项目运行 ant sn-p。
【问题讨论】:
-
所以你需要在作为子模块的项目中执行相同的插件并将上面的 pom 声明为父模块?
-
是的,类似的。
-
不,这不是 stackoverflow.com/questions/8480606/… 的副本。那个问题是如何使用某些参数调用 ant,这个问题是关于如何在 pom 层次结构的不同位置重用相同的 ant 调用。
-
有一个简单的方法。将参数写入属性文件并在 ant 脚本中读取此文件。