Can I configure multiple plugin executions in pluginManagement, and choose from them in my child POM?

前端 未结 1 974
醉话见心
醉话见心 2021-02-01 02:28

I have 2 common plugin-driven tasks that I want to execute in my projects. Because they\'re common, I want to move their configuration to the pluginMangement sectio

1条回答
  •  死守一世寂寞
    2021-02-01 02:36

    You're correct, by default Maven will include all of the executions you have configured. Here's how I've dealt with that situation before.

    
      
        org.apache.maven.plugins
        some-maven-plugin
        1.0
        
          
            first-execution
            none
            
               some-goal
            
            
              
            
          
          
            second-execution
            none
            
               other-goal
            
            
              
            
          
        
      
    
    

    Note, the executions are bound to phase none. In the child, you enable the parts that should execute like this:

    
        org.apache.maven.plugins
        some-maven-plugin
        
          
            first-execution         
            prepare-package   
          
          
        
    
    

    If the child doesn't explicitly bind the execution to a phase, it won't run. This allows you to pick and choose the executions desired.

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