java - How to prevent pushing SNAPSHOT version in maven-release-plugin? -
i have maven project lots of modules (and modules inside modules). using maven-release-plugin controlling versions in pom.xml files.
when running command mvn release:prepare plugin pushing 2 commits messages: "[maven-release-plugin] prepare release v0.9.0.38" , "[maven-release-plugin] prepare next development iteration" accordingly. herein second 1 snapshot version.
here maven-release-plugin settings:
<build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-release-plugin</artifactid> <version>2.5.3</version> <configuration> <tagnameformat>v@{project.version}</tagnameformat> <autoversionsubmodules>true</autoversionsubmodules> <checkmodificationexcludes> <checkmodificationexclude>pom.xml</checkmodificationexclude> <checkmodificationexclude>*/pom.xml</checkmodificationexclude> </checkmodificationexcludes> <branchbase>master</branchbase> </configuration> </plugin> </plugins> </build> when pushing setting tag remote git project (you can see in <tagnameformat>v@{project.version}</tagnameformat>) need push commits definitely, don't want push snapshot versions (e.g. 0.9.0.38-snapshot).
edit:
the problem:
as incrementing minor version of project on each commit running
mvn release:prepare.
e.g. commits looks following:
[maven-release-plugin] prepare next development iteration
[maven-release-plugin] prepare release v0.9.0.38
(refactor) code cleaned up
[maven-release-plugin] prepare next development iteration
[maven-release-plugin] prepare release v0.9.0.37
(feature) added i18n support
this looks ugly, , pushing 3 commits on every change bad solution incrementing minor version of pom file not manually.
what need?
- before every commit increment project version (including modules)
- and set tag remote git repository.
- and should done 1 commit custom message
how can achieve this?
described behavior intended - plugin increments version of modules after releasing them normal. main advice think twice before customizing it.
if you're using git, can set pushchanges false avoid pushing. after can rollback last commit , push changes
git reset head~ --hard git push origin master advice more practical if explained why consider second commit redundant.
also can use dryrun switch if you're not sure changes.
update:
- do changes
mvn versions:set -dnewversion=<version-to-set> -dgeneratebackuppoms=falsegit commit -m "your-comment"git tag <your-tag>- push commit/tag
these steps can aggregated script file avoid monkey-job.
as alternative, can buildnumber-maven-plugin, can useful.
Comments
Post a Comment