尝试跑步
mvn -Prelease-profile help:effective-pom。您会发现您有两个执行部分
maven-source-plugin
输出将如下所示:
<plugin> <artifactId>maven-source-plugin</artifactId> <version>2.0.4</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> <execution> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>
要解决此问题,请找到您使用过的所有地方
maven-source-plugin,并确保使用“ id”附加源,使其与发布配置文件相同。然后这些部分将被合并。
最佳实践表明,要获得一致性,您需要在项目的根POM中的build> pluginManagement中而 不是
在子poms中进行配置。在子pom中,您只需在build> plugins中指定要使用maven-source-plugin,但不提供执行。
在房间pom.xml中:
<build> <pluginManagement> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <!-- This id must match the -Prelease-profile id value or else sources will be "uploaded" twice, which causes Nexus to fail --> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </pluginManagement></build>
在子pom.xml中:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> </plugin> </plugins></build>



