
Daniel Huchthausen
- Consultant -
When he is not exploring the wilderness, Daniel keeps himself busy with topics such as quality assurance, testing and PM methods.
Use SCM-Manager Universe to implement an automated release-management for your projects. You can do that by using Jenkins and Sonatype Nexus. In this post we will show the necessary configuration for Maven projects with an automated deploy of snapshots and release of new versions.
Automating the deployment of your projects to Sonatype Nexus has 2 major benefits.
The described process will deploy a snapshot version to Sonatype Nexus each time it is built successfully with Jenkins. The release of a new version will automatically adjust the version number of the project and create a new snapshot with an incremented version number. This leads to 2 commits to the repository.
The implementation of this process requires 2 plugins for Jenkins:
Aside from those plugins there are only a few modifications to the pom.xml and to the Jenkins job configuration necessary.
For the implementation of the automated release process it is necessary to add the following 4 sections to the pom.xml:
This section contains the information about the location of the repository. Normally you need three connection types here:
Here you have to provide the information about the required Maven plugins.
In order to release new versions automatically it is necessary to provide the name and the location of the target locations in Sonatype Nexus for the snapshot and the release versions.
If you want to use the latest snapshot version for each build you can configure an update policy for the snapshot repository. If you don’t provide a value for the update policy the default value is never. Jenkins Configuration
Build section: clean deploy (each snapshot version gets deployed to Nexus)
In the section Build Environment you need to enable two option: Provide configuration files and Maven release options. The configuration file is required for the usage of a settings.xml in Jenkins, the other option enables release builds.
By checking the option Maven release builds you enable the possibility of manually starting Maven releases for the project.
By implementing the automated release process for snapshots and new releases of your projects you ensure that the sources are always up to date. Hence all developers can rely on the fact that the dependencies they use are up to date. Besides that you automate the release-management for your projects. Of course you will have to find a policy of deleting expendable snapshot releases, otherwise you will have tons of data of old snapshots.