最近我們將 maven 版本更改為 3.5.4Maven Super POM 中的 maven-source-plugin jar 目標已更改為 jar-no-fork我們有公司主 pom:<plugin>? ? <groupId>org.apache.maven.plugins</groupId>? ? <artifactId>maven-source-plugin</artifactId>? ? <version>3.0.1</version>? ? <executions>? ? ? ? <execution>? ? ? ? ? ? <id>attach-sources</id>? ? ? ? ? ? <goals>? ? ? ? ? ? ? ? <goal>jar</goal>? ? ? ? ? ? </goals>? ? ? ? </execution>? ? </executions></plugin>哪一項是我無法改變的。與我得到的有效pom中的maven super pom一起<plugin>? <artifactId>maven-source-plugin</artifactId>? <version>3.0.1</version>? <executions>? ? <execution>? ? ? <id>attach-sources</id>? ? ? <goals>? ? ? ? <goal>jar-no-fork</goal>? ? ? ? <goal>jar</goal>? ? ? </goals>? ? </execution>? </executions>? <inherited>true</inherited></plugin>在發布期間,源會生成兩次(一個文件覆蓋第二個文件),但在部署到 Artifactory 時,我收到錯誤,因為沒有覆蓋工件的權限。我可以配置一些如何我的 pom 來禁用插件的一個目標嗎?
1 回答

慕標5832272
TA貢獻1966條經驗 獲得超4個贊
您需要從父 pom 中刪除執行(刪除默認階段就足夠了)并添加具有新目標的新執行:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase/>
</execution>
<execution>
<id>custom-attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
</plugin>
添加回答
舉報
0/150
提交
取消