Author: nicolas
Date: Thu Jan 10 05:29:27 2008
New Revision: 610784

URL: http://svn.apache.org/viewvc?rev=610784&view=rev
Log:
[MRELEASE-313] parameter to set profiles to enable on forked maven instance ran 
by release:perform

Modified:
    
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
    
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
    
maven/release/trunk/maven-release-plugin/src/site/apt/examples/perform-release.apt

Modified: 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java?rev=610784&r1=610783&r2=610784&view=diff
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
 (original)
+++ 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java
 Thu Jan 10 05:29:27 2008
@@ -105,7 +105,8 @@
      * @parameter expression="${arguments}" alias="prepareVerifyArgs"
      */
     private String arguments;
-
+               
+       
     /**
      * The file name of the POM to execute any goals against.
      *
@@ -172,36 +173,54 @@
         descriptor.setWorkingDirectory( basedir.getAbsolutePath() );
 
         descriptor.setPomFileName( pomFileName );
+               
+               List profiles = project.getActiveProfiles();
 
-        List profiles = project.getActiveProfiles();
-
-        String arguments = this.arguments;
-        if ( profiles != null && !profiles.isEmpty() )
-        {
-            if ( !StringUtils.isEmpty( arguments ) )
-            {
-                arguments += " -P ";
-            }
-            else
-            {
-                arguments = "-P ";
-            }
-
-            for ( Iterator it = profiles.iterator(); it.hasNext(); )
-            {
-                Profile profile = (Profile) it.next();
-
-                arguments += profile.getId();
-                if ( it.hasNext() )
-                {
-                    arguments += ",";
-                }
-            }
-        }
+               String arguments = this.arguments;
+               if ( profiles != null && !profiles.isEmpty() )
+               {
+                       if ( !StringUtils.isEmpty( arguments ) )
+                       {
+                               arguments += " -P ";
+                       }
+                       else
+                       {
+                               arguments = "-P ";
+                       }
+
+                       for ( Iterator it = profiles.iterator(); it.hasNext(); )
+                       {
+                               Profile profile = (Profile) it.next();
+
+                               arguments += profile.getId();
+                               if ( it.hasNext() )
+                               {
+                                       arguments += ",";
+                               }
+                       }
+
+                       String additionalProfiles = getAdditionalProfiles();
+                   if ( additionalProfiles != null )
+                   {
+                           if ( ! profiles.isEmpty() )
+                               {
+                                   arguments += ",";
+                               }
+                           arguments += additionalProfiles;
+                       }
+               }
         descriptor.setAdditionalArguments( arguments );
 
         return descriptor;
     }
+       
+       /**
+        * @return additional profiles to enable during release
+        */
+       protected String getAdditionalProfiles()
+       {
+               return null;
+       }               
 
     void setReleaseManager( ReleaseManager releaseManager )
     {

Modified: 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java?rev=610784&r1=610783&r2=610784&view=diff
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
 (original)
+++ 
maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java
 Thu Jan 10 05:29:27 2008
@@ -51,6 +51,14 @@
      */
     private String goals;
 
+       /**
+     * Comma separated profiles to enable on deployment, in addition to active 
profiles 
+        * for project execution.
+     *
+     * @parameter
+     */
+    private String releaseProfiles;
+       
     /**
      * The checkout directory.
      *
@@ -76,6 +84,11 @@
      */
     private boolean useReleaseProfile;
 
+       protected String getAdditionalProfiles()
+       {
+               return releaseProfiles;
+       }
+       
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {

Modified: 
maven/release/trunk/maven-release-plugin/src/site/apt/examples/perform-release.apt
URL: 
http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/site/apt/examples/perform-release.apt?rev=610784&r1=610783&r2=610784&view=diff
==============================================================================
--- 
maven/release/trunk/maven-release-plugin/src/site/apt/examples/perform-release.apt
 (original)
+++ 
maven/release/trunk/maven-release-plugin/src/site/apt/examples/perform-release.apt
 Thu Jan 10 05:29:27 2008
@@ -45,4 +45,25 @@
 mvn release:perform 
-DconnectionUrl=scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-release-plugin-2.0
 -------
 
+  release:perform will fork a new maven instance to build the checked-out 
project. This new maven instance will use the 
+  same system configuration and maven profiles used by the one running the 
release:perform goal. 
+  
+  It is possible to
+  force some profiles to get enabled during release (for example to enable 
time-consummung tasks that are only relevant
+  at release-time) by setting a coma separated list of profiles names in the 
releaseProfiles parameter. The goals and
+  profiles required to release the project can then be configured in the POM :
+  
+-------
+  <plugin>
+        <artifactId>maven-release-plugin</artifactId>
+        <configuration>
+                       <!--
+                         During release:perform, enable the "release" profile
+                         -->
+                       <releaseProfiles>release</releaseProfiles>
+                       <goals>deploy assembly:assembly</goals>
+               </configuration>
+  </plugin>
+-------
+
   After the release is complete, the <<<release.properties>>> and other 
release files will be removed from the checkout.


Reply via email to