【发布时间】:2011-01-25 20:30:17
【问题描述】:
我有一堆 maven 项目需要在构建/部署阶段使用 maven-antrun-plugin 执行相同的 ant 任务序列。
我不想在父项目中覆盖 maven-antrun-plugin 的实现,因此使用此插件的所有其他项目都将继承这些步骤。
因此,我正在考虑编写自己的 maven 插件,该插件可用作 maven-antrun-plugin 包装器,具有特殊的 ant 任务序列。但目前我没有成功。
我看过:
http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html
但遇到此处描述的相同问题:
http://www.mail-archive.com/users@maven.apache.org/msg92676.html
(使用上面帖子中建议的版本并不能解决问题)
从: http://www.mail-archive.com/users@maven.apache.org/msg115264.html 看来本教程仅适用于 maven2:
我也试图从这里偷东西:
http://maven.apache.org/guides/plugin/guide-java-plugin-development.html
但仍然没有可用的插件。
我要包装的插件是这样的:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>test</id>
<phase>deploy</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- execute task A,B and D -->
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
是否可以将任务 A、B 和 C 的顺序放在另一个插件中,然后在需要的地方使用该插件?
我还尝试将 antrun 插件移至父级,并为某些将继承设置为 false 的子级禁用它:
但父级中定义的任务仍在执行,因此将继承设置为 false 似乎不起作用。
【问题讨论】: