我有一个maven pom.xml,它将运行一些蚂蚁任务。有些任务仅用于特定配置文件,而有些任务则适用于所有配置文件。这是我的
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- Some of my common task -->
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<build>
<profiles>
<profile>
<id>developement</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- Task specifics for profile -->
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<build>
</profile>
</profiles>我使用以下命令运行该项目
mvn clean install -P developement在构建此项目时,常见的任务没有运行。仅运行配置文件中的任务。是因为我在共享插件和配置文件插件中使用了相同的artifactID吗?
我的环境:
Java1.6Maven 2.2.1 Windows 7 64位
发布于 2013-09-12 14:36:37
所示的两次执行都缺少<id>元素。因此,Maven使用它的默认执行ID,而概要文件执行覆盖公共的执行ID。
若要修复,请向两者添加ID,如图所示,并使用您选择的值。
<!-- common configuration -->
<executions>
<execution>
<id>antrun-common</id>
<phase>test</phase>
....
<!-- development profile configuration -->
<executions>
<execution>
<id>antrun-development</id>
<phase>test</phase>https://stackoverflow.com/questions/18759549
复制相似问题