Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.0-beta-4
-
Fix Version/s: None
-
Component/s: perform
-
Labels:None
-
Number of attachments :
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
| This issue is related to: | ||||
| MNG-3268 | Command line doesn't handle multiple -P correctly |
|
|
|
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();
{ cliProfiles += ","; }if ( it.hasNext() )
}
if ( !StringUtils.isEmpty( arguments ) )
{ arguments = arguments.replaceFirst("-P *([^ ]*)? *", cliProfiles + ",$1 "); }{
if( arguments.indexOf("-P") >= 0 )
else
{ arguments += " " + cliProfiles; }}
{ arguments = cliProfiles; }else
}
config.setAdditionalArguments( arguments );