Maven 2.x Release Plugin

The plugin should merge the profiles on a release:perform

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0-beta-4
  • Fix Version/s: None
  • Component/s: perform
  • Labels:
    None
  • Number of attachments :
    0

Description

In my super-pom, I have set the following arguments:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<arguments>-Dmaven.test.skip.exec=true -P m1-deploy</arguments>
<useReleaseProfile>false</useReleaseProfile>
</configuration>
</plugin>

I want to skip the tests during a release and enable a profile that will also deploy the artifacts in my maven1 repository.

However for some projects I want to enable more profiles on the command line.
After the prepare, they are written in the release.properties and executed by the perform goal.
However, maven does not support multiple -P arguments on the command line.

I would be nice if the plugin could detect and merge multiple -P arguments

Issue Links

Activity

Hide
Daniel Beland added a comment -

I had a look at the code and it can be done quite easily by creating the String with the active profiles first and then replacing the profiles in the arguments using a regex expression.

This has been done against our home version of the release plugin. which is 2.0-beta-4 with some customs modifications.
I am sorry I cannot do it in the current SCM SNAPSHOT and provide a patch as I don't want to download SNAPSHOT libraries in our company repository.

Hope this can help anyway:

String arguments = this.arguments;
if ( profiles != null && !profiles.isEmpty() )
{
String cliProfiles = "-P ";

for ( Iterator it = profiles.iterator(); it.hasNext(); )
{
Profile profile = (Profile) it.next();

cliProfiles += profile.getId();
if ( it.hasNext() )

{ cliProfiles += ","; }

}

if ( !StringUtils.isEmpty( arguments ) )
{
if( arguments.indexOf("-P") >= 0 )

{ arguments = arguments.replaceFirst("-P *([^ ]*)? *", cliProfiles + ",$1 "); }

else

{ arguments += " " + cliProfiles; }

}
else

{ arguments = cliProfiles; }

}
config.setAdditionalArguments( arguments );

Show
Daniel Beland added a comment - I had a look at the code and it can be done quite easily by creating the String with the active profiles first and then replacing the profiles in the arguments using a regex expression. This has been done against our home version of the release plugin. which is 2.0-beta-4 with some customs modifications. I am sorry I cannot do it in the current SCM SNAPSHOT and provide a patch as I don't want to download SNAPSHOT libraries in our company repository. Hope this can help anyway: String arguments = this.arguments; if ( profiles != null && !profiles.isEmpty() ) { String cliProfiles = "-P "; for ( Iterator it = profiles.iterator(); it.hasNext(); ) { Profile profile = (Profile) it.next(); cliProfiles += profile.getId(); if ( it.hasNext() ) { cliProfiles += ","; } } if ( !StringUtils.isEmpty( arguments ) ) { if( arguments.indexOf("-P") >= 0 ) { arguments = arguments.replaceFirst("-P *([^ ]*)? *", cliProfiles + ",$1 "); } else { arguments += " " + cliProfiles; } } else { arguments = cliProfiles; } } config.setAdditionalArguments( arguments );

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated: