Some plugins can help here, as mentioned in this answer , and in the comments of this : Maven Release Plugin , if you want to fully automate the release and / or Maven version plugin .
With Maven Release Plugin
The project is released using the Maven Release Plugin in two stages: prepare and perform and this is what the documentation on release:prepare writes release:prepare Purpose:
The preparation of the release goes through the following stages of the release:
- Make sure that there are no uncommitted changes in the sources.
- Make sure there are no SNAPSHOT dependencies
- Change the version in the POM from x-SNAPSHOT to the new version (you will be offered versions for use)
- Convert SCM information to POM to enable final tag assignment
- Run project tests with modified POMs to confirm that everything is operational
- Commit Modified POM
- Mark the code in SCM with the version name (this will be requested for)
- Configure the version in POM to the new y-SNAPSHOT value (these values will also be suggested)
- Commit Modified POM
In other words, the Maven Release Plugin does exactly what you ask for.
With Maven Version Plugin
If you are not using the Maven Release Plugin, you may need the Maven Versions Plugin . In particular, the following objectives:
versions:update-parent updates the parent section of the project so that it refers to the latest available version. For example, if you use the corporate root POM, this goal may be useful if you need to make sure that you are using the latest version of the corporate root POM.versions:update-child-modules updates the parent section of the child modules of the project, so the version matches the version of the current project. For example, if you have an aggregator pom, which is also a parent for projects that it has aggregates and children and parents versions out of sync, this mojo can help fix the version of the child modules. (Note that you may need to call Maven with the -N option to complete this task if your project is so bad that it cannot build due to an incorrect version version).versions:set can be used to install the project version from the command line.versions:commit removes pom.xml.versionsBackup files. forms one half of the integrated SCM Poor.versions:revert recovers pom.xml files from pom.xml.versionsBackup files. forms one half of the integrated SCM Poor.
I mentioned several goals, but the “most interesting” is probably versions:update-child-modules here. This will change the version in the upper parent folder and then automate the update of the child. See Fixing the assembly of several modules for an example.
I can no longer help, you need to experiment now. Good luck
References
source share