I cannot find a solution for activating some Maven profile on release:prepare and release:perform (both) goals. Something like this:
This looks like a duplicate question. Please take a look at this question, it has an answer. maven release plugin ignores releaseProfile
Basically version 2.2.1 of the release plugin adds a releaseProfiles parameter that will allow you to define the profiles to enable during release.
http://maven.apache.org/plugins/maven-release-plugin/examples/perform-release.html
Unfortunately, it looks like there's a bug that will prohibit it from doing what you want...
Edit
One thing that I have used in this case is not using the -P argument, but rather triggering the profile through an environment setting using -Denv=release. Then in the POM, I have the profile activation based on the value of env. This has always worked for me.
Because maven release plugin start additional instance you have to specify additional arguments. For you case
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4</version>
<configuration>
<arguments>${myReleaseArgs}</arguments>
</configuration>
</plugin>
and execution
mvn release:prepare release:perform -DmyReleaseArgs="-Pmy-release -DskipTests=true" -Pmy-release -DskipTests=true
and yes it must be duplicated.
It works in Jenkins by activating the profile for both release:prepare and release:perform by setting both properties
<build>
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<releaseProfiles>myprofile</releaseProfiles>
<arguments>-Pmyprofile</arguments>
</configuration>
</plugin>
</plugins>
</build >
Even though the above works great, I found more useful to use file activated profiles. The old concept with a 'master' profile was causing a problem, as I had the profile in my parent pom. That meant, it was getting activated in every single module, arbitrary.
To solve it, I used the file activation method in profile. It works even better and as a bonus it simplifies the release in Jenkins. In Eclipse, in command line, in Jenkins, aka everywhere, maven detects the file and the maven-release-plugin does not have to be configured. Plus the profile is active only in the right module.
-Darguments="-PmyProfile" seems to do the job.