Execute Maven plugin goal on parent module, but not on children

前端 未结 5 1520
生来不讨喜
生来不讨喜 2020-12-08 01:47

We have a multi-module maven project that uses a profile that defines a buildnumber-maven-plugin to increment a build number and then check it into source control.

I

5条回答
  •  爱一瞬间的悲伤
    2020-12-08 02:11

    You can add false to the plugin configuration to avoid inheritance in children POMs:

          
            org.codehaus.mojo
            buildnumber-maven-plugin
            1.0-beta-3
            false
            ...
          
    

    Or, if your plugin has multiple executions, you can control which executions are inherited and which are not by adding the inherited tag to the execution body:

    
      org.apache.maven.plugins
        maven-antrun-plugin
        
          
            parent-only
            initialize
            false
            
              
                
              
            
            
              run
            
          
          
            all-modules
            initialize
            true 
            
              
                
              
            
            
              run
            
          
        
      
    

提交回复
热议问题