I'm having a Jenkins with the M2 release plugin. I have a job for building AND releasing.
The used repository has master and feature/bugfix branches. The job is configured to build all branches. The master branch is deployed in addition. All stable changes are merged into master branch but the latest changes (not working yet) are made in a bugfix branch. Therefore the latest build (mvn install) is made on this bugfix branch.
If I want to release this project jenkins takes the latest built revision (the bugfix branch) and tries to release this. Due to SNAPSHOT dependencies this is failing.
I could of course set the "branch to build" to "master" when releasing. But a) I would need to reset this after release and b) this would be necessary everytime i want to release.
I also could make this build parameterized with branch options but then this job will not be executed by scm commits.
So my question is: Is there a way/plugin to tell jenkins to release a specific branch?
EDIT: I added my pom.xml so you might be able to provide an easy to understand example
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>my.parent.gid</groupId>
<artifactId>my.iarent.aid</artifactId>
<version>1.0.0</version>
</parent>
<name>Project Name</name>
<groupId>my.project.gid</groupId>
<artifactId>my.project.aid</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<url>${project_url}</url>
<ciManagement>
<system>${project_ciManagement.system}</system>
<url>${project_ciManagement.url}</url>
</ciManagement>
<scm>
<!-- read access -->
<connection>${project_scm.connection}</connection>
<!-- write access (release-plugin) -->
<developerConnection>${project_scm.developerConnection}</developerConnection>
<!-- browser access -->
<url>${project_scm.url}</url>
<tag>HEAD</tag>
</scm>
<properties>
<compiler.javaVersion>1.7</compiler.javaVersion>
<scm.repo>repo_name</scm.repo>
</properties>
<modules>
<module>Module1</module>
<module>Module2</module>
<module>Module3</module>
</modules>