Maven release plugin fails : source artifacts getting deployed twice

后端 未结 12 1754
故里飘歌
故里飘歌 2020-11-28 22:04

We are using the maven release plugin on hudson and trying to automate the release process. The release:prepare works fine. When we try to do the release:perform , it fails

12条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 22:19

    Try running mvn -Prelease-profile help:effective-pom. You will find that you have two execution sections for maven-source-plugin

    The output will look something like this:

        
          maven-source-plugin
          2.0.4
          
            
              attach-sources
              
                jar
              
            
            
              
                jar
              
            
          
        
    

    To fix this problem, find everywhere you have used maven-source-plugin and make sure that you use the "id" attach-sources so that it is the same as the release profile. Then these sections will be merged.

    Best practice says that to get consistency you need to configure this in the root POM of your project in build > pluginManagement and NOT in your child poms. In the child pom you just specify in build > plugins that you want to use maven-source-plugin but you provide no executions.

    In the room pom.xml:

    
      
        
          
            org.apache.maven.plugins
            maven-source-plugin
            
              
                
                attach-sources
                
                  jar
                
              
            
          
            
      
    
    

    In the child pom.xml:

    
      
        
          org.apache.maven.plugins
          maven-source-plugin
        
      
    
    

提交回复
热议问题