How to trigger a Maven Release job from a pipeline job in Jenkins

Fernando Calderón
1 min readMar 17, 2018

I’ve been working on building a CI/CD pipeline in order to automate our release process that we had been performing manually. As part of this work, we needed to create a Jenkins Pipeline job that will call another job configured to release our application using Maven Release plugin.

Unfortunately, there’s no an easy way to trigger a Maven Release from other job (like build job: ‘job-name’, parameters: [params] when using a Groovy script). This task has been open in Jira since July 2015 with no updates yet.

So our solution was to perform a curl request in Groovy, sending the parameters in order to trigger the Maven Release job, something like:

We tried that in our Jenkins pipeline and it worked, it scheduled a new build with the params we send. But that’s it, the stage was green regardless the Maven Release failed or not. To check the result of the Maven Release build and based on that, mark the stage as succeed or failed, we needed to do something like:

Hope it will help you.

--

--