maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1585772 - in /maven/release/trunk: maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ maven-release-plugin/ maven-release-plugin/src/main/j...
Date Tue, 08 Apr 2014 16:19:18 GMT
Author: simonetripodi
Date: Tue Apr  8 16:19:17 2014
New Revision: 1585772

URL: http://svn.apache.org/r1585772
Log:
MRELEASE-431 - Configuration of policy for calculating next (release) version

release:prepare MOJO is now able to configure the VersionPolicy ID


Modified:
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java
    maven/release/trunk/maven-release-plugin/pom.xml
    maven/release/trunk/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java?rev=1585772&r1=1585771&r2=1585772&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java
Tue Apr  8 16:19:17 2014
@@ -53,16 +53,16 @@ public class PropertiesReleaseDescriptor
     extends AbstractLogEnabled
     implements ReleaseDescriptorStore
 {
-    
+
     /**
      * When this plugin requires Maven 3.0 as minimum, this component can be removed and
o.a.m.s.c.SettingsDecrypter be
      * used instead.
-     * 
+     *
      * @plexus.requirement role="org.sonatype.plexus.components.sec.dispatcher.SecDispatcher"
role-hint="mng-4384"
      */
-    
+
     private DefaultSecDispatcher secDispatcher;
-    
+
     public ReleaseDescriptor read( ReleaseDescriptor mergeDescriptor )
         throws ReleaseDescriptorStoreException
     {
@@ -226,6 +226,10 @@ public class PropertiesReleaseDescriptor
         {
             properties.setProperty( "completionGoals", config.getCompletionGoals() );
         }
+        if ( config.getProjectVersionPolicyId() != null )
+        {
+            properties.setProperty( "projectVersionPolicyId", config.getProjectVersionPolicyId()
);
+        }
 
         properties.setProperty( "exec.snapshotReleasePluginAllowed",
                                 Boolean.toString( config.isSnapshotReleasePluginAllowed()
) );
@@ -336,7 +340,7 @@ public class PropertiesReleaseDescriptor
     {
         return new File( mergeDescriptor.getWorkingDirectory(), "release.properties" );
     }
-    
+
     // From org.apache.maven.cli.MavenCli.encryption(CliRequest)
     private String encryptAndDecorate( String passwd ) throws IllegalStateException, SecDispatcherException,
PlexusCipherException
     {

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java?rev=1585772&r1=1585771&r2=1585772&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java
Tue Apr  8 16:19:17 2014
@@ -120,6 +120,9 @@ public class ReleaseUtils
         // Not overridden - not configured from caller
         mergeInto.setCompletedPhase( mergeDefault( mergeInto.getCompletedPhase(), toBeMerged.getCompletedPhase()
) );
 
+        mergeInto.setProjectVersionPolicyId(
+            mergeDefault( mergeInto.getProjectVersionPolicyId(), toBeMerged.getProjectVersionPolicyId()
) );
+
         return mergeInto;
     }
 
@@ -132,7 +135,7 @@ public class ReleaseUtils
     {
         return thisValue != null ? thisValue : mergeValue;
     }
-    
+
     private static boolean mergeOverride( boolean thisValue, boolean mergeValue, boolean
defaultValue )
     {
         return mergeValue != defaultValue ? mergeValue : thisValue;
@@ -158,6 +161,7 @@ public class ReleaseUtils
         releaseDescriptor.setPomFileName( properties.getProperty( "exec.pomFileName" ) );
         releaseDescriptor.setPreparationGoals( properties.getProperty( "preparationGoals"
) );
         releaseDescriptor.setCompletionGoals( properties.getProperty( "completionGoals" )
);
+        releaseDescriptor.setProjectVersionPolicyId( properties.getProperty( "projectVersionPolicyId"
) );
         String snapshotReleasePluginAllowedStr = properties.getProperty( "exec.snapshotReleasePluginAllowed"
);
         releaseDescriptor.setSnapshotReleasePluginAllowed( snapshotReleasePluginAllowedStr
== null
                                                                ? false

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java?rev=1585772&r1=1585771&r2=1585772&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java
(original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java
Tue Apr  8 16:19:17 2014
@@ -41,14 +41,14 @@ import org.codehaus.plexus.util.StringUt
 
 /**
  * Map projects to their new versions after release / into the next development cycle.
- * 
+ *
  * The map-phases per goal are:
  * <dl>
  *  <dt>release:prepare</dt><dd>map-release-versions + map-development-versions;
RD.isBranchCreation() = false</dd>
  *  <dt>release:branch</dt><dd>map-branch-versions + map-development-versions;
RD.isBranchCreation() = true</dd>
  *  <dt>release:update-versions</dt><dd>map-development-versions; RD.isBranchCreation()
= false</dd>
  * </dl>
- * 
+ *
  * <p>
  * <table>
  *   <tr>
@@ -69,7 +69,7 @@ public class MapVersionsPhase
     extends AbstractReleasePhase
 {
     private ResourceBundle resourceBundle;
-    
+
     /**
      * Whether to convert to a snapshot or a release.
      */
@@ -84,8 +84,8 @@ public class MapVersionsPhase
      * Component used to prompt for input.
      */
     private Prompter prompter;
-    
-    
+
+
     /**
      * Component used for custom or default version policy
      */
@@ -101,7 +101,7 @@ public class MapVersionsPhase
         throws ReleaseExecutionException
     {
         ReleaseResult result = new ReleaseResult();
-        
+
         resourceBundle = getResourceBundle( releaseEnvironment.getLocale() );
 
         MavenProject rootProject = ReleaseUtil.getRootProject( reactorProjects );
@@ -194,8 +194,8 @@ public class MapVersionsPhase
         return result;
     }
 
-    private String resolveNextVersion( MavenProject project, 
-                                   String projectId, 
+    private String resolveNextVersion( MavenProject project,
+                                   String projectId,
                                    ReleaseDescriptor releaseDescriptor,
                                    ReleaseResult result )
         throws ReleaseExecutionException
@@ -209,7 +209,7 @@ public class MapVersionsPhase
             {
                 return project.getVersion();
             }
-            
+
             defaultVersion = getReleaseVersion( projectId, releaseDescriptor );
         }
         else if ( !convertToSnapshot ) // map-release-version
@@ -224,7 +224,7 @@ public class MapVersionsPhase
             {
                 return project.getVersion();
             }
-            
+
             defaultVersion = getDevelopmentVersion( projectId, releaseDescriptor );
         }
         else
@@ -234,11 +234,11 @@ public class MapVersionsPhase
             {
                 return project.getVersion();
             }
-            
+
             defaultVersion = getDevelopmentVersion( projectId, releaseDescriptor );
         }
         //@todo validate default version, maybe with DefaultArtifactVersion
-        
+
         String suggestedVersion = null;
         String nextVersion = defaultVersion;
         String messageKey = null;
@@ -253,12 +253,12 @@ public class MapVersionsPhase
                     {
                         baseVersion = getReleaseVersion( projectId, releaseDescriptor );
                     }
-                    // unspecified and unmapped version, so use project version 
+                    // unspecified and unmapped version, so use project version
                     if ( baseVersion == null )
                     {
                         baseVersion = project.getVersion();
                     }
-                    
+
                     try
                     {
                         try
@@ -288,7 +288,7 @@ public class MapVersionsPhase
                         throw new ReleaseExecutionException( e.getMessage(), e );
                     }
                }
-                
+
                 if ( releaseDescriptor.isInteractive() )
                 {
                     if ( messageKey == null )
@@ -298,7 +298,7 @@ public class MapVersionsPhase
                     String message =
                         MessageFormat.format( resourceBundle.getString( messageKey ), project.getName(),
projectId );
                     nextVersion = prompter.prompt( message, suggestedVersion );
-                    
+
                   //@todo validate next version, maybe with DefaultArtifactVersion
                 }
                 else
@@ -317,7 +317,6 @@ public class MapVersionsPhase
     private String resolveSuggestedVersion( String baseVersion, String policyId )
         throws PolicyException, VersionParseException
     {
-        // right now only default available
         VersionPolicy policy = versionPolicies.get( policyId );
         VersionPolicyRequest request = new VersionPolicyRequest().setVersion( baseVersion
);
 
@@ -344,7 +343,7 @@ public class MapVersionsPhase
         }
         return nextVersion;
     }
-    
+
 
     private String getMapversionPromptKey( ReleaseDescriptor releaseDescriptor )
     {

Modified: maven/release/trunk/maven-release-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-plugin/pom.xml?rev=1585772&r1=1585771&r2=1585772&view=diff
==============================================================================
--- maven/release/trunk/maven-release-plugin/pom.xml (original)
+++ maven/release/trunk/maven-release-plugin/pom.xml Tue Apr  8 16:19:17 2014
@@ -29,7 +29,7 @@
 
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-release-plugin</artifactId>
-  <version>3,0-SNAPSHOT</version>
+  <version>3.0-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
 
   <name>Maven Release Plugin</name>

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=1585772&r1=1585771&r2=1585772&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
Tue Apr  8 16:19:17 2014
@@ -36,7 +36,7 @@ import org.apache.maven.shared.release.c
  * used. This can be followed by a call to <tt>release:perform</tt>. For more
info see <a
  * href="http://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html"
  * >http://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html</a>.
- * 
+ *
  * @author <a href="mailto:jdcasey@apache.org">John Casey</a>
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -69,7 +69,7 @@ public class PrepareReleaseMojo
 
     /**
      * Whether to update dependencies version to the next development version.
-     * 
+     *
      * @since 2.0-beta-5
      */
     @Parameter( defaultValue = "true", property = "updateDependencies" )
@@ -78,7 +78,7 @@ public class PrepareReleaseMojo
     /**
      * Whether to automatically assign submodules the parent version. If set to false, the
user will be prompted for the
      * version of each submodules.
-     * 
+     *
      * @since 2.0-beta-5
      */
     @Parameter( defaultValue = "false", property = "autoVersionSubmodules" )
@@ -108,7 +108,7 @@ public class PrepareReleaseMojo
     /**
      * Goals to run on completion of the preparation step, after transformation back to the
next development version but
      * before committing. Space delimited.
-     * 
+     *
      * @since 2.2
      */
     @Parameter( defaultValue = "", property = "completionGoals" )
@@ -116,7 +116,7 @@ public class PrepareReleaseMojo
 
     /**
      * Commits to do are atomic or by project.
-     * 
+     *
      * @since 2.0-beta-5
      */
     @Parameter( defaultValue = "false", property = "commitByProject" )
@@ -124,7 +124,7 @@ public class PrepareReleaseMojo
 
     /**
      * Whether to allow timestamped SNAPSHOT dependencies. Default is to fail when finding
any SNAPSHOT.
-     * 
+     *
      * @since 2.0-beta-7
      */
     @Parameter( defaultValue = "false", property = "ignoreSnapshots" )
@@ -133,7 +133,7 @@ public class PrepareReleaseMojo
     /**
      * Whether to allow usage of a SNAPSHOT version of the Release Plugin. This in an internal
property used to support
      * testing of the plugin itself in batch mode.
-     * 
+     *
      * @since 2.0-beta-9
      */
     @Parameter( defaultValue = "false", property = "allowReleasePluginSnapshot", readonly
= true )
@@ -142,7 +142,7 @@ public class PrepareReleaseMojo
     /**
      * A list of additional exclude filters that will be skipped when checking for modifications
on the working copy. Is
      * ignored, when checkModificationExcludes is set.
-     * 
+     *
      * @since 2.1
      */
     @Parameter
@@ -150,7 +150,7 @@ public class PrepareReleaseMojo
 
     /**
      * Command-line version of checkModificationExcludes.
-     * 
+     *
      * @since 2.1
      */
     @Parameter( property = "checkModificationExcludeList" )
@@ -158,7 +158,7 @@ public class PrepareReleaseMojo
 
     /**
      * Default version to use when preparing a release or a branch.
-     * 
+     *
      * @since 2.0-beta-8
      */
     @Parameter( property = "releaseVersion" )
@@ -166,7 +166,7 @@ public class PrepareReleaseMojo
 
     /**
      * Default version to use for new local working copy.
-     * 
+     *
      * @since 2.0-beta-8
      */
     @Parameter( property = "developmentVersion" )
@@ -180,15 +180,15 @@ public class PrepareReleaseMojo
      * <li>You may not want to use this in conjunction with <code>suppressCommitBeforeTag</code>,
such that no poms with
      * released versions are committed to the working copy ever.</li>
      * </ul>
-     * 
+     *
      * @since 2.0-beta-9
      */
-    @Parameter( defaultValue = "true", property = "remoteTagging" ) 
+    @Parameter( defaultValue = "true", property = "remoteTagging" )
     private boolean remoteTagging;
 
     /**
      * Whether to bump the working copy versions to <code>developmentVersion</code>.
-     * 
+     *
      * @since 2.1
      */
     @Parameter( defaultValue = "true", property = "updateWorkingCopyVersions" )
@@ -201,23 +201,31 @@ public class PrepareReleaseMojo
      * <br/>
      * <code>suppressCommitBeforeTag</code> is useful when you want to avoid
poms with released versions in all
      * revisions of your trunk or development branch.
-     * 
+     *
      * @since 2.1
      */
-    @Parameter( defaultValue = "false", property = "suppressCommitBeforeTag" ) 
+    @Parameter( defaultValue = "false", property = "suppressCommitBeforeTag" )
     private boolean suppressCommitBeforeTag;
 
     /**
      * Wait the specified number of second before creating the tag. <br/>
      * <code>waitBeforeTagging</code> is useful when your source repository is
synced between several instances and
      * access to it is determined by geographical location, like the SVN repository at the
Apache Software Foundation.
-     * 
+     *
      * @since 2.2
      */
     @Parameter( defaultValue = "0", property = "waitBeforeTagging" )
     private int waitBeforeTagging;
 
     /**
+     * The {@code VersionPolicy} ID.
+     *
+     * @since 3.0
+     */
+    @Parameter( defaultValue = "default", property = "projectVersionPolicyId" )
+    private String projectVersionPolicyId;
+
+    /**
      * {@inheritDoc}
      */
     public void execute()
@@ -256,6 +264,7 @@ public class PrepareReleaseMojo
         config.setUpdateWorkingCopyVersions( updateWorkingCopyVersions );
         config.setSuppressCommitBeforeTagOrBranch( suppressCommitBeforeTag );
         config.setWaitBeforeTagging( waitBeforeTagging );
+        config.setProjectVersionPolicyId( projectVersionPolicyId );
 
         if ( checkModificationExcludeList != null )
         {



Mime
View raw message