Maven release: next development version in batch mode

后端 未结 7 2409
一生所求
一生所求 2021-02-19 23:13

I have configured a Jenkins job to release my maven project automatically. This is done by using the following: mvn --batch-mode clean release:prepare release:perform

7条回答
  •  清酒与你
    2021-02-19 23:42

    I had the same problem and I wanted to resolve it without running more than one command or by inserting the version manually.

    Here is my solution for y (or minor) increment:

    I run a Groovy script in initialize phase. This script creates release.properties. Add this to your project/build/plugins section in your pom.xml:

            
                org.codehaus.gmavenplus
                gmavenplus-plugin
                1.5
                
                    
                        org.codehaus.groovy
                        groovy-all
                        2.4.6
                    
                
                
                    
                    
                        release-parameters
                        initialize
                        
                            execute
                        
                        
                            
                                
                            
                        
                    
                
            
    

    This script changes also the tag name for vX.Y.Z in your SCM. The initialize phase is not executed in the release:prepare phase. To resolve this issue, you can run a "mvn install" before a release, or change your release command to:

    mvn --batch-mode initialize clean release:prepare release:perform
    

    About release.properties: https://maven.apache.org/maven-release/maven-release-plugin/examples/non-interactive-release.html

提交回复
热议问题