maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1002513 - in /maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release: AbstractReleaseMojo.java BranchReleaseMojo.java PrepareReleaseMojo.java UpdateVersionsMojo.java
Date Wed, 29 Sep 2010 08:18:39 GMT
Author: brett
Date: Wed Sep 29 08:18:39 2010
New Revision: 1002513

URL: http://svn.apache.org/viewvc?rev=1002513&view=rev
Log:
[MRELEASE-524] improve consistency of applying versions from the command line, allowing -Dproject.dev.g:a=v
to work for release:branch

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/BranchReleaseMojo.java
    maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
    maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java

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=1002513&r1=1002512&r2=1002513&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
Wed Sep 29 08:18:39 2010
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Profile;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -198,6 +199,14 @@ public abstract class AbstractReleaseMoj
      */
     private ScmManager scmManager;
 
+    /**
+     * @parameter expression="${session}"
+     * @readonly
+     * @required
+     * @since 2.0
+     */
+    protected MavenSession session;
+
 
     /**
      * Gets the enviroment settings configured for this release.
@@ -363,4 +372,25 @@ public abstract class AbstractReleaseMoj
             arguments = argument;
         }
     }
+
+    /**
+     * This method takes some of the release configuration picked up from the command line
system properties and copies
+     * it into the release config object.
+     *
+     * @param config The release configuration to merge the system properties into, must
not be <code>null</code>.
+     * @param sysPropertiesConfig The configuration from the system properties to merge in,
must not be
+     *            <code>null</code>.
+     */
+    protected void mergeCommandLineConfig( ReleaseDescriptor config, ReleaseDescriptor sysPropertiesConfig
)
+    {
+        // If the user specifies versions, these should override the existing versions
+        if ( sysPropertiesConfig.getReleaseVersions() != null )
+        {
+            config.getReleaseVersions().putAll( sysPropertiesConfig.getReleaseVersions()
);
+        }
+        if ( sysPropertiesConfig.getDevelopmentVersions() != null )
+        {
+            config.getDevelopmentVersions().putAll( sysPropertiesConfig.getDevelopmentVersions()
);
+        }
+    }
 }

Modified: maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java?rev=1002513&r1=1002512&r2=1002513&view=diff
==============================================================================
--- maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java
(original)
+++ maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java
Wed Sep 29 08:18:39 2010
@@ -24,6 +24,7 @@ import org.apache.maven.plugin.MojoFailu
 import org.apache.maven.shared.release.ReleaseExecutionException;
 import org.apache.maven.shared.release.ReleaseFailureException;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
+import org.apache.maven.shared.release.config.ReleaseUtils;
 
 /**
  * Branch a project in SCM, using the same steps as the <tt>release:prepare</tt>
goal, creating a branch instead of a tag.
@@ -173,6 +174,12 @@ public class BranchReleaseMojo
         config.setRemoteTagging( remoteTagging );
         config.setDefaultReleaseVersion( releaseVersion );
         config.setDefaultDevelopmentVersion( developmentVersion );
+
+        // Create a config containing values from the session properties (ie command line
properties with cli).
+        ReleaseDescriptor sysPropertiesConfig
+                = ReleaseUtils.copyPropertiesToReleaseDescriptor( session.getExecutionProperties()
);
+        mergeCommandLineConfig( config, sysPropertiesConfig );
+        
         try
         {
             releaseManager.branch( config, getReleaseEnvironment(), reactorProjects, dryRun
);

Modified: maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java?rev=1002513&r1=1002512&r2=1002513&view=diff
==============================================================================
--- maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
(original)
+++ maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java
Wed Sep 29 08:18:39 2010
@@ -161,14 +161,6 @@ public class PrepareReleaseMojo
     private boolean remoteTagging;
 
     /**
-     * @parameter expression="${session}"
-     * @readonly
-     * @required
-     * @since 2.0
-     */
-    protected MavenSession session;
-
-    /**
      * {@inheritDoc}
      */
     public void execute()
@@ -222,25 +214,4 @@ public class PrepareReleaseMojo
         }
     }
 
-    /**
-     * This method takes some of the release configuration picked up from the command line
system properties and copies
-     * it into the release config object.
-     *
-     * @param config The release configuration to merge the system properties into, must
not be <code>null</code>.
-     * @param sysPropertiesConfig The configuration from the system properties to merge in,
must not be
-     *            <code>null</code>.
-     */
-    private void mergeCommandLineConfig( ReleaseDescriptor config, ReleaseDescriptor sysPropertiesConfig
)
-    {
-        // If the user specifies versions, these should override the existing versions
-        if ( sysPropertiesConfig.getReleaseVersions() != null )
-        {
-            config.getReleaseVersions().putAll( sysPropertiesConfig.getReleaseVersions()
);
-        }
-        if ( sysPropertiesConfig.getDevelopmentVersions() != null )
-        {
-            config.getDevelopmentVersions().putAll( sysPropertiesConfig.getDevelopmentVersions()
);
-        }
-    }
-
 }

Modified: maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java?rev=1002513&r1=1002512&r2=1002513&view=diff
==============================================================================
--- maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java
(original)
+++ maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java
Wed Sep 29 08:18:39 2010
@@ -114,26 +114,4 @@ public class UpdateVersionsMojo
             throw new MojoFailureException( e.getMessage(), e );
         }
     }
-
-    /**
-     * This method takes some of the release configuration picked up from the command line
system properties and copies
-     * it into the release config object.
-     *
-     * @param config The release configuration to merge the system properties into, must
not be <code>null</code>.
-     * @param sysPropertiesConfig The configuration from the system properties to merge in,
must not be
-     *            <code>null</code>.
-     */
-    private void mergeCommandLineConfig( ReleaseDescriptor config, ReleaseDescriptor sysPropertiesConfig
)
-    {
-        // If the user specifies versions, these should override the existing versions
-        if ( sysPropertiesConfig.getReleaseVersions() != null )
-        {
-            config.getReleaseVersions().putAll( sysPropertiesConfig.getReleaseVersions()
);
-        }
-        if ( sysPropertiesConfig.getDevelopmentVersions() != null )
-        {
-            config.getDevelopmentVersions().putAll( sysPropertiesConfig.getDevelopmentVersions()
);
-        }
-    }
-
 }



Mime
View raw message