Is it possible to use the maven-release-plugin with a specific revision?
Asked Answered
I

2

6

I am thinking about a deployment pipeline using SVN, Jenkins and Maven. At the moment I'm stuck at the point where I usually would call mvn release:perform on a working copy.

When thinking in deployment pipelines, I want to create a pipeline where every commit could be used to release a software to test/production. Let's say I have 5 builds, and I decide to release build 3 (with revision 3) to production. There will already be 2 new commits to trunk (which is now at revision 5).

Is it possible to use the maven-release-plugin to checkout/build/tag/commit a release at revision 3? When the maven-release-plugin finishes the release it usually commits the modified POMs to trunk.

I'm happy about any kind of information or advice here, so feel free to point me to books (like http://www.amazon.com/Continuous-Delivery-Deployment-Automation-Addison-Wesley/dp/0321601912), blog posts, Jenkins documentation... Maybe I'm completely on the wrong track.

Induline answered 11/1, 2013 at 8:30 Comment(0)
I
2

By default, the release plugin creates the release based on the contents of your working copy, it just ensures that you don't have any uncommitted content before doing so. AFAIK it doesn't force an update of the sources, as that's usually the job of the Continuous Integration system (Jenkins in your case). So whatever is checked out by Jenkins will be released.

What you're trying to do sounds more like a configuration change on the Jenkins side, pointing it to the right revision.

On the other hand, if the POM files are modified as part of the release, but have been changed in SVN in the meantime, you will run into a conflict when Maven wants to check in the modified POM files. That's a situation that might happen, depending on how for back you want to go with the release.

Based on this, it might make more sense to always create a branch before doing a release. So you would create a branch based on revision 3 and then create your release in that branch. This way, you wouldn't run into issues with committing resources that have changed in more recent revisions.

Creating the branch and checking it out could probably be automated through Jenkins and Maven as well.

Idealism answered 11/1, 2013 at 15:54 Comment(1)
How can we automate the release process in jenkins.Please go through this #18779486Anticholinergic
E
1

As far as I tested it, it is not possible.

More explicitely, as nwinler said, when you release, maven try to commit the modified pom. But, if it's an older revision than the current one, SVN will complain that your sources are not up to date. So it won't work. ... as far as I know.

You may read docs about promotion build. I don't find any one clear enough to be pointed out (in th few minutes of the writing of this message).

Emory answered 13/1, 2013 at 11:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.