-
✓ versions-maven-plugin
-
✓ maven-release-plugin
-
✓ build-helper-maven-plugin
-
✓ maven-scm-plugin
-
✓ maven-deploy-plugin
-
❏ docker-maven-plugin
-
❏ consider using something bigger e.g. vehicle fleet or bootiful microservices
-
checkout 1.0-SNAPSHOT
-
git clone
-
-
update POM version to 1.0-RELEASE
-
mvn versions:set -DnewVersion=
-
mvn versions:update-properties -Dincludes=com.example:*
-
-
compile, test
-
mvn clean test
-
docker build
-
-
commit, tag, publish, deploy
-
commit
-
mvn scm:tag -DVERSION_NUMBER=${BUILD_NUMBER}
-
publish
-
mvn deploy
-
docker push
-
-
install, or
docker push
-
-
update POM to 2.0-SNAPSHOT
-
versions:set -DnewVersion=
-
-
commit
Below are most relevant for deployment purposes.
Full list is available under: https://maven.apache.org/plugins/index.html
Parses POM to find versions and sets properties:
- Current version properties:
-
-
parsedVersion.majorVersion
-
parsedVersion.minorVersion
-
parsedVersion.incrementalVersion
-
parsedVersion.qualifier
-
parsedVersion.buildNumber
-
- Next version properties:
-
-
parsedVersion.nextMajorVersion
-
parsedVersion.nextMinorVersion
-
parsedVersion.nextIncrementalVersion
-
parsedVersion.nextBuildNumber
-
http://www.mojohaus.org/versions-maven-plugin/usage.html
Use -DgenerateBackupPoms=false
in command line or plugin configuration to avoid backup POMs generation.
-
mvn versions:display-dependency-updates
deep dependency update candidates -
mvn versions:display-property-updates
-
mvn versions:set -DnewVersion=2.1.0-SNAPSHOT -DgenerateBackupPoms=false
-
mvn versions:use-latest-releases
- update dependencies -
mvn versions:update-parent
-
mvn versions:update-properties -Dincludes=com:* -DgenerateBackupPoms=false
- update properties which are used as dependency versions -
mvn versions:lock-snapshots
,mvn versions:unlock-snapshots
Use --batch-mode
for non-interactive mode. fro example mvn release:update-versions --batch-mode
-
no SNAPSHOTs
-
Change the version in the POMs from x-SNAPSHOT to a new version
-
Run the project tests
-
Commit the modified POMs
-
Bump the version in the POMs to a new value y-SNAPSHOT
-
Commit the modified POMs
Task which may be useful for releasing: mvn scm:tag
Use -DpushChanges=false
if push is done outside of maven.
In order to use project version as a tag:
<configuration>
<tag>${project.version}</tag>
</configuration>
Publish artifact to artifact repository.
Add following conf for it to work:
<distributionManagement>
<repository>
<id>internal.repo</id>
<url>http://repo.example.com/repository/example</url>
</repository>
</distributionManagement>
And in settings.xml
:
<server>
<id>internal.repo</id>
<username>maven</username>
<password>foobar</password>
</server>
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0 -DgenerateBackupPoms=false
mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false