Maven Sortpom プラグインはプロジェクトのビルドの結果に影響を与えますか?
sortpom プラグインが追加されたという理由だけで、プロジェクトのビルドが失敗する可能性はありますか?
Maven Sortpom プラグインはプロジェクトのビルドの結果に影響を与えますか?
sortpom プラグインが追加されたという理由だけで、プロジェクトのビルドが失敗する可能性はありますか?
通常、pom.xml ファイル内の要素の順序は重要ではないため、要素の順序を変更してもビルドには影響しません。
しかし、私はこの規則の 2 つの例外を知っています。
デフォルトでは、sortpom プラグインは依存関係もプラグインもソートしません。したがって、sortpom プラグインがプロジェクトのビルドの結果に影響を与えるべきではないと言えます。
ビルドに失敗する可能性があります:
[エラー] ゴール com.google.code.sortpom:maven-sortpom-plugin:2.3.0:sort (default) をプロジェクト data-extractor で実行できませんでした: scm.team.company.corp: 不明なホスト scm.team-project .company.corp -> [ヘルプ 1]
-o を指定して実行しても、ネットワークの問題によりファイルが見つからない場合
はい。
たとえば、次を使用します。
org.codehaus.mojo:build-helper-maven-plugin
のフェーズでのreserve-network-port
目標pre-integration-test
org.apache.tomcat.maven:tomcat7-maven-plugin
のrun
目標も段階的にpre-integration-test
次に、sortpom:sort
それらを並べ替えます。maven-3 では、プラグインの順序が重要です。portName
そのため、の機能を使用して tomcat のランダム ポートを構成するreserve-network-port
と、システム プロパティは (必要な時点で) 埋められません。これは、並べ替えの後、ビルド ヘルパー アーティファクトがゴールが呼び出された後に実行されるためrun
です。
ソート後の例:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<fork>true</fork>
</configuration>
</execution>
<!-- ... -->
</executions>
<configuration>
<fork>true</fork>
<port>${tomcat.http.port}</port><!-- Oops, not set (yet)! -->
</configuration>
</plugin>
<!-- ... -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper.version}</version>
<executions>
<execution>
<id>reserve-tomcat-port</id>
<phase>pre-integration-test</phase>
<goals>
<goal>reserve-network-port</goal>
</goals>
<configuration>
<portNames>
<portName>tomcat.http.port</portName><!-- Too late -->
</portNames>
</configuration>
</execution>
</executions>
</plugin>