Java Maven:共享插件和概要文件构建插件中的相同artifactID
我有一个maven pom.xml,它将运行一些ant任务组。有些任务仅适用于特定配置文件,有些任务适用于所有配置文件的通用配置文件。这是我的Java Maven:共享插件和概要文件构建插件中的相同artifactID,java,maven,pom.xml,maven-antrun-plugin,Java,Maven,Pom.xml,Maven Antrun Plugin,我有一个maven pom.xml,它将运行一些ant任务组。有些任务仅适用于特定配置文件,有些任务适用于所有配置文件的通用配置文件。这是我的 <build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.1</version>
<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>
生成此项目时,公用任务未运行。配置文件中的任务仅在运行。这是因为我在共享插件和配置文件插件中使用了相同的artifactID吗
我的环境:
Java 1.6
Maven 2.2.1
Windows 7 64位显示的两个执行都缺少
元素。因此,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>
安特伦公墓
测试
....
安特伦发展
测试
是的,你是对的。向执行添加id修复了我的问题。谢谢
<!-- common configuration -->
<executions>
<execution>
<id>antrun-common</id>
<phase>test</phase>
....
<!-- development profile configuration -->
<executions>
<execution>
<id>antrun-development</id>
<phase>test</phase>