Maven2 - problem with pluginManagement and parent-child relationship

后端 未结 4 1561
不思量自难忘°
不思量自难忘° 2020-12-14 09:56

from maven documentation

pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same

4条回答
  •  渐次进展
    2020-12-14 10:21

    In parent pom you should configure executions with declared but don't declare . Then in the child pom you'll declare:

    
      some-plugin
      
        
          execution-id
          partcular-phase
        
      
    
    

    The plugin won't be executed until you define a phase in the child pom. Thus you'll need to explicitly bind executions to phases in every child pom (or in the middle of hierarchy), but you won't need to copy-paste configuration of these executions.

    Note, that lots of plugins have Default Phase, e.g. Enforcer Plugin is bound to validate by default. Even if you don't bind plugin to a phase explicitly, it will be bound anyway and thus the plugin will be executed. To overcome this, use non-existing phase in your parent:

    
      execution-id
      some-goal
      none
    
    

提交回复
热议问题