I am writing a little java program to perform the complete release of a complex code organization. In short, my program needs to release ("Perform Maven release") a project "ProjectA" THROUGH Jenkins. Then once this release process is finished and successful, the program will detect the new version number generated. Then it will update this new version number into the properties of the pom files of the other projects (say "ProjectB" and "ProjectC" that are depending on that ProjectA, and commit this modified files in SVN. Then my program will trigger the "perform maven release" job on Projects B and C.
I precise that I want the release process to be executed inside/by Jenkins, because I want to have the traces of these actions in the history... I don't want to use directly the "maven-release-plugin" (outside Jenkins), because there would be not trace in the history of Jenkins builds...
For this I need to call the action "Perform Maven release" available in Jenkins from this Java program. How can I do that? (I've coded already all the other steps).
During my tests, I managed to call the "Build" job which is 'pure' Jenkins like this:
WindowsCommandLineExecutor windowsCommandLineExecutor = new WindowsCommandLineExecutor();
int exitCode = windowsCommandLineExecutor.execCmd("java -jar lib/jenkins-cli.jar -s http://MyJenkinsUrl.com:1234/ build \"MyProjectName\" -s --username MyJenkinsUserName --password MyJenkinsPassword", true);
but the "Perform Maven release" job (if I'm not wrong) is available in Jenkins only because we integrated the plugin "Maven-release-plugin", it's not a 'pure' Jenkins job (out-of-the-box)... This explains I guess why there isn't any command such as "performRelease" in this JenkinsCLI tool: http://javadoc.jenkins-ci.org/?hudson/cli/CLICommand.html .
Any idea, any advice?