【发布时间】:2011-01-16 04:17:19
【问题描述】:
更新为(希望)澄清:如果将目标定义为在给定阶段运行,是否可以在不运行所有阶段的情况下运行单个目标。换句话说,是否可以运行antrun:run 目标(定义为下面安装阶段的一部分)而无需获取依赖项、生成资源、编译、测试、打包等?
我在package 阶段使用antrun 插件创建一个zip 文件,并在install 阶段删除和复制一些文件。我了解如何运行单个 Maven 插件目标,例如:mvn antrun:run。但是,有没有办法运行特定的执行目标? mvn antrun:run:execution-id 或 mvn phase:antrun:run 之类的?
基本上,如果我可以告诉 maven 除了在部署阶段运行下面定义的 ant 任务之外什么都不做,我会很好。必须等待 maven 完成所有阶段以检查部署阶段中的 ant 任务是否正常工作,这有点乏味。
<executions>
<!-- create zip file -->
<execution>
<id>create-zip</id>
<phase>package</phase>
<configuration>
<tasks>
...create zip...
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<!-- do some other stuff -->
<execution>
<id>copy-files</id>
<phase>install</phase>
<configuration>
<tasks>
...delete some files, copy some files ...
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
【问题讨论】: