[ 
http://jira.codehaus.org/browse/MRELEASE-288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_107858
 ] 

Daniel Beland commented on MRELEASE-288:
----------------------------------------

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 );



> The plugin should merge the profiles on a release:perform
> ---------------------------------------------------------
>
>                 Key: MRELEASE-288
>                 URL: http://jira.codehaus.org/browse/MRELEASE-288
>             Project: Maven 2.x Release Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0-beta-4
>            Reporter: Daniel Beland
>
> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to