In a Maven project, how can I automatically update the version all child modules, plus the parent?

前端 未结 4 675
梦谈多话
梦谈多话 2021-01-30 02:05

I have a multi-module project.

parent POM (1.0-SNAPSHOT)
|-- module1 (1.0-SNAPSHOT)
|-- module2 (1.0-SNAPSHOT)
`-- module3 (1.0-SNAPSHOT)

When I execute m

4条回答
  •  渐次进展
    2021-01-30 02:17

    The release plugin can handle that. Did you check Updating POM Versions? But... I don't get something. Changing the version in the POMs from x-SNAPSHOT to a new version and bumping the version in the POMs to a new value y-SNAPSHOT should be done by release:prepare as explained in Prepare a Release. What is going wrong when using this goal?

    Update: The autoVersionSubmodules parameter might be what you're looking for. From the Prepare a Release example:

    Multi-module projects

    You will be prompted for the version number for each module of the project. If you prefer that every module gets the same version as the parent POM, you can set the option autoVersionSubmodules to true. Now you will be asked only once for the release version and the next development version.

    Snippet of parent pom.xml

    
        
            
                org.apache.maven.plugins
                maven-release-plugin
                x.y.z
                
                    deploy
                    true
                
            
        
    
    

提交回复
热议问题