1

複数のモジュールを持つ Maven プロジェクトを構築しようとしています。そのため、pom.xml で指定された順序でビルドされることを期待していますが、ビルド中のモジュールの順序が pom.xml ファイルに記載されている順序と同じではないことがわかります。その理由は何ですか?

私のMavenバージョン:Apache Maven 3.0.4

4

2 に答える 2

1

親pomファイルで言及した順序は、モジュール間に依存関係のクラッシュがない場合にも関連します。つまり、リストの上にあるモジュールが存在し、それがその下にあるモジュールに依存している場合、この場合は順序POMファイルに記載されているものは使用されません.Mavenは彼の頭脳を使用して、最初に他のモジュールが構築するために必要とするすべてのモジュールを構築します.

ビルド順序の詳細については、この質問Maven Spec on same をご覧ください。

仕様から:

Reactor Sorting

Because modules within a multi-module build can depend on each other, 
it is important that The reactor sorts all the projects in a way that 
guarantees any project is built before it is required.

The following relationships are honoured when sorting projects:

    1. project dependency on another module in the build
    2. plugin declaration where the plugin is another modules in the build
    3. plugin dependency on another module in the build
    4. build extension declaration on another module in the build
    5. the order declared in the modules element (if no other rule applies)

Note that only "instantiated" references are used - dependencyManagement 
and pluginManagement elements will not cause a change to the reactor 
sort order.
于 2013-08-08T07:29:45.033 に答える