Invoking m2release plugin on Hudson with cURL

A short information on how to execute a M2 Release Plugin on Hudson CI using cURL

Let us assume that your Hudson is visible at HUDSON_URL.

[IMPORTANT this stopped working around Hudson 1.363 when the maven release screen was redesigned]

Execution of normal build

Executing a normal build is easy. All you have to do is to execute a command like:

curl HUDSON_URL/job/NAME_OF_YOUR_JOB/build?delay=0sec

for example

curl http://hudson.mycompany.pl/job/my-job/build?delay=0sec

Execution of release build

Now you want to "Perform a Maven Release". Because this command is triggered as a POST form submission you need to use "-d" switch and pass few parameters.
I haven't checked if you can omit some of them. I guess it should be possible and default values would be used instead.

curl -d "-Dproject.rel.GROUP_ID%3ANAME_OF_YOUR_JOB=RELEASE_VERSION&-Dproject.dev.GROUP_ID%3ANAME_OF_YOUR_JOB=NEXT_DEV_VERSION&json=%7B%7D&Submit=Schedule+Maven+Release+Build" HUDSON_URLjob/NAME_OF_YOUR_JOB/m2release/submit

for example

curl -d "-Dproject.rel.pl.mygroup%3Amy-job=1.2&-Dproject.dev.pl.mygroup%3Amy-job=1.2-SNAPSHOT&json=%7B%7D&Submit=Schedule+Maven+Release+Build" http://hudson.mycompany.pl/job/my-job/m2release/submit

BTW. Many thanks to developers of Live HTTP Headers Firefox extension ! It helped me a lot to learn what parameters should be passed in POST request.

Please comment using