Impose build order for a multi-project in Maven

前端 未结 2 1183
感情败类
感情败类 2020-12-31 07:29

I have a multi project in maven like this:

paren-project
  -> plugin-project
  -> testbed-project

The plugin project gen

相关标签:
2条回答
  • 2020-12-31 07:51

    As it is mentioned at the http://maven.apache.org/guides/mini/guide-multiple-modules.html

    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

    0 讨论(0)
  • 2020-12-31 07:52

    Maven is a versatile system. No need to switch.

    You can add the dependency like this:

    <dependency>
      <groupId>group</groupId> 
      <artifactId>artifact</artifactId> 
      <optional>true</optional> 
    </dependency>
    

    This way, the dependency will not be included in the classpath.

    Read more about Optional Dependency

    0 讨论(0)
提交回复
热议问题