I'm using Jenkins to build Maven Java projects and deploy them to a Nexus repository. I also use Git, although I'm more used to Subversion so my Git knowledge is limited.
I'd like Jenkins/Maven to:
I gather the Git merging can be achieved thus: http://twasink.net/2011/09/20/git-feature-branches-and-jenkins-or-how-i-learned-to-stop-worrying-about-broken-builds/
I've also read a lot about the maven-release-plugin
.
I'm not sure how exactly to achieve the above results. If I hardcode SCM details into each project's POM, then won't the maven-release-plugin
be acting only on that repository rather than Jenkins' local one?
If I use a solution of having Jenkins pass a environment variable to Maven to specify the version number, then I'd expect to have local version resolution issues in my IDE.
OK, this a quite a difficult to do. But it's doable. Let me explain the idea step by step.
First we need to merge the two branches together. This is quite easy to do with Jenkins Git plugin, as it have this feature built in: Merge before build option is available in Advanced section in your project configuration.
So we got the code merged between those two branches, we can move to building the project - business as usual, Maven style Jenkins project.
Now we need to increment the version of the project and it's modules, commit the merged branch and push the artifacts to the repository. And here we have two options to go with:
-DconnectionUrl=
. And if none will be provided, it will check release.properties file to get it from there. Last reserve is to go to the pom.xml ang get ${project.scm.connection}
variable. So you can easily use the plugin to do all of the dirty work without any hassles and introduce that property using different techniques provided by Jenkins.In both cases you can use the Post Steps with Run only if build succeeds option and invoke the top-level Maven target as usual. For all of the settings mentioned above or described by the particular plugin there is an option to provide them easily in a text field. For uploading your artifacts to the Nexus repo I would go with Jenkins build in feature to Deploy artifacts to Maven repository, that is availble within your project configuration. This will require you to provide a repository configuration in either the POM definition, or as property.
Hope that covers all of the questions you have. If you need me to be more specific in any range of the answer, don't hesitate to ask.