diff --git a/Jenkinsfile b/Jenkinsfile index 09ac70f12..e9f05f7d9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,4 +17,4 @@ * under the License. */ -asfMavenTlpStdBuild() +asfMavenTlpPlgnBuild() diff --git a/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java b/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java index 0accda371..804400492 100644 --- a/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java +++ b/maven-release-api/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptor.java @@ -110,7 +110,7 @@ public interface ReleaseDescriptor /** * Get nOTE : currently only implemented with svn scm. Enable a workaround to prevent issue due to svn client > - * 1.5.0 (http://jira.codehaus.org/browse/SCM-406). + * 1.5.0 (https://issues.apache.org/jira/browse/SCM-406). * * @return boolean */ @@ -133,6 +133,18 @@ public interface ReleaseDescriptor */ boolean isPushChanges(); + /** + * Get default version to use for new working copy. + * + * Some SCMs may require a Work Item or a Task to allow the + * changes to be pushed or delivered. + * This field allows you to specify that Work Item + * or Task. It is optional, and only relevant if pushChanges is true. + * + * @return String + */ + String getWorkItem(); + /** * Get default version to use for new working copy. * @@ -207,6 +219,12 @@ public interface ReleaseDescriptor */ boolean isScmUseEditMode(); + /** + * + * @return list of profiles to activate + */ + List getActivateProfiles(); + /** * Get the last completed phase. * @@ -256,6 +274,38 @@ public interface ReleaseDescriptor */ String getScmCommentPrefix(); + /** + * Get the SCM commit comment when setting pom.xml to release. + * + * @return String + * @since 3.0.0-M1 + */ + String getScmReleaseCommitComment(); + + /** + * Get the SCM commit comment when setting pom.xml back to development. + * + * @return String + * @since 3.0.0-M1 + */ + String getScmDevelopmentCommitComment(); + + /** + * Get the SCM commit comment when branching. + * + * @return String + * @since 3.0.0-M1 + */ + String getScmBranchCommitComment(); + + /** + * Get the SCM commit comment when rolling back. + * + * @return String + * @since 3.0.0-M1 + */ + String getScmRollbackCommitComment(); + /** * Get pass phrase for the private key. * @@ -416,20 +466,19 @@ public interface ReleaseDescriptor void setScmSourceUrl( String scmUrl ); /** - * Get whether unresolved snapshot dependencies are automatically resolved. - * If this is set to "true", then the default values for the dependency's - * release and next development version are used. + * Returns whether unresolved SNAPSHOT dependencies should automatically be resolved. + * If this is set, then this specifies the default answer to be used when unresolved SNAPSHOT + * dependencies should automatically be resolved ( 0:All 1:Project Dependencies 2:Plugins + * 3:Reports 4:Extensions ). Possible values are: + * * - * @return boolean - */ - boolean isAutoResolveSnapshotDependencies(); - - /** - * Get the default answer to be used when unresolved snapshot dependencies - * should automatically be resolved ( 0:All 1:Project Dependencies 2:Plugins - * 3:Reports 4:Extensions ). - * - * @return int + * @return String */ - int getAutoResolveSnapshotDependenciesMode(); + String getAutoResolveSnapshots(); } diff --git a/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/AetherVersion.java b/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/AetherVersion.java index c03a42bd7..58139fbc9 100644 --- a/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/AetherVersion.java +++ b/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/AetherVersion.java @@ -27,7 +27,7 @@ class AetherVersion { private final org.eclipse.aether.version.Version version; - public AetherVersion( String version ) + AetherVersion( String version ) throws VersionParseException { try diff --git a/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/MavenArtifactVersion.java b/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/MavenArtifactVersion.java index 19ae0593d..1c379fba5 100644 --- a/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/MavenArtifactVersion.java +++ b/maven-release-api/src/main/java/org/apache/maven/shared/release/versions/MavenArtifactVersion.java @@ -27,7 +27,7 @@ class MavenArtifactVersion { private final ArtifactVersion version; - public MavenArtifactVersion( String version ) + MavenArtifactVersion( String version ) { this.version = new DefaultArtifactVersion( version ); } diff --git a/maven-release-api/src/site/site.xml b/maven-release-api/src/site/site.xml new file mode 100644 index 000000000..220ecbb57 --- /dev/null +++ b/maven-release-api/src/site/site.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/maven-release-manager/pom.xml b/maven-release-manager/pom.xml index 6d970d707..1fd90971d 100644 --- a/maven-release-manager/pom.xml +++ b/maven-release-manager/pom.xml @@ -200,7 +200,6 @@ org.codehaus.modello modello-maven-plugin - 1.9.1 diff --git a/maven-release-manager/src/main/components-fragment.xml b/maven-release-manager/src/main/components-fragment.xml index 6f156e919..6bb0f3165 100644 --- a/maven-release-manager/src/main/components-fragment.xml +++ b/maven-release-manager/src/main/components-fragment.xml @@ -20,6 +20,7 @@ + org.apache.maven.shared.release.strategy.Strategy default @@ -76,6 +77,7 @@ + org.apache.maven.shared.release.phase.ReleasePhase map-release-versions @@ -141,7 +143,7 @@ - prepare release {0} + getScmReleaseCommitComment @@ -154,7 +156,7 @@ - prepare for next development iteration + getScmDevelopmentCommitComment rollback changes from release preparation of {0} @@ -168,7 +170,7 @@ - prepare branch {0} + getScmBranchCommitComment @@ -181,7 +183,7 @@ - rollback the release of {0} + getScmRollbackCommitComment diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java index 25fb7d03b..375861ba1 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManager.java @@ -103,26 +103,41 @@ public void prepare( ReleasePrepareRequest prepareRequest ) private void prepare( ReleasePrepareRequest prepareRequest, ReleaseResult result ) throws ReleaseExecutionException, ReleaseFailureException { + final ReleaseDescriptorBuilder builder = prepareRequest.getReleaseDescriptorBuilder(); // Create a config containing values from the session properties (ie command line properties with cli). ReleaseUtils.copyPropertiesToReleaseDescriptor( prepareRequest.getUserProperties(), - new ReleaseDescriptorBuilder() - { - public ReleaseDescriptorBuilder addDevelopmentVersion( String key, - String value ) - { - builder.addDevelopmentVersion( key, value ); - return this; - } - - public ReleaseDescriptorBuilder addReleaseVersion( String key, - String value ) - { - builder.addReleaseVersion( key, value ); - return this; - }; - } ); + new ReleaseDescriptorBuilder() + { + public ReleaseDescriptorBuilder addDevelopmentVersion( String key, + String value ) + { + builder.addDevelopmentVersion( key, value ); + return this; + } + + public ReleaseDescriptorBuilder addReleaseVersion( String key, + String value ) + { + builder.addReleaseVersion( key, value ); + return this; + } + + public ReleaseDescriptorBuilder addDependencyReleaseVersion( String dependencyKey, + String version ) + { + builder.addDependencyReleaseVersion( dependencyKey, version ); + return this; + } + + public ReleaseDescriptorBuilder addDependencyDevelopmentVersion( String dependencyKey, + String version ) + { + builder.addDependencyDevelopmentVersion( dependencyKey, version ); + return this; + } + } ); BuilderReleaseDescriptor config; if ( BooleanUtils.isNotFalse( prepareRequest.getResume() ) ) @@ -131,7 +146,7 @@ public ReleaseDescriptorBuilder addReleaseVersion( String key, } else { - config = ReleaseUtils.buildReleaseDescriptor( prepareRequest.getReleaseDescriptorBuilder() ); + config = ReleaseUtils.buildReleaseDescriptor( builder ); } Strategy releaseStrategy = getStrategy( config.getReleaseStrategyId() ); @@ -666,4 +681,4 @@ private void captureException( ReleaseResult result, ReleaseManagerListener list result.setResultCode( ReleaseResult.ERROR ); } -} \ No newline at end of file +} diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManagerListener.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManagerListener.java new file mode 100644 index 000000000..b8bbb2315 --- /dev/null +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/DefaultReleaseManagerListener.java @@ -0,0 +1,109 @@ +package org.apache.maven.shared.release; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.plugin.logging.Log; +import org.codehaus.plexus.util.StringUtils; + +import static org.apache.maven.shared.utils.logging.MessageUtils.buffer; + +/** + * @author Hervé Boutemy + */ +public class DefaultReleaseManagerListener + implements ReleaseManagerListener +{ + private final Log log; + + private final boolean dryRun; + + private String goal; + + private List phases; + + private int currentPhase; + + public DefaultReleaseManagerListener( Log log ) + { + this( log, false ); + } + + public DefaultReleaseManagerListener( Log log, boolean dryRun ) + { + this.log = log; + this.dryRun = dryRun; + } + + private void nextPhase( String name ) + { + currentPhase++; + if ( !name.equals( phases.get( currentPhase ) ) ) + { + log.warn( "inconsistent phase name: expected '" + phases.get( currentPhase ) + "' but got '" + name + "'" ); + } + } + + public void goalStart( String goal, List phases ) + { + log.info( "starting " + buffer().strong( goal ) + " goal" + ( dryRun ? " in dry-run mode" : "" ) + + ", composed of " + phases.size() + " phases: " + StringUtils.join( phases.iterator(), ", " ) ); + currentPhase = -1; + this.phases = phases; + this.goal = goal; + } + + public void phaseStart( String name ) + { + if ( goal == null || ( ( currentPhase + 1 ) >= phases.size() ) ) + { + // out of goal phase + log.info( "phase " + buffer().strong( name ) + ( dryRun ? " (dry-run)" : "" ) ); + return; + } + + nextPhase( name ); + log.info( buffer().strong( "[" + goal + ( dryRun ? " dry-run" : "" ) + "] " ).toString() + ( currentPhase + 1 ) + + "/" + phases.size() + " " + buffer().strong( name ) ); + } + + public void phaseEnd() + { + // NOOP + } + + public void phaseSkip( String name ) + { + nextPhase( name ); + } + + public void goalEnd() + { + goal = null; + phases = null; + } + + public void error( String reason ) + { + log.error( "error during phase " + ( currentPhase + 1 ) + "/" + phases.size() + " " + phases.get( currentPhase ) + + ": " + reason ); + } +} diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java index 7c9f9845f..f1272de62 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/PropertiesReleaseDescriptorStore.java @@ -35,6 +35,7 @@ import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.util.StringUtils; import org.sonatype.plexus.components.cipher.DefaultPlexusCipher; import org.sonatype.plexus.components.cipher.PlexusCipherException; import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher; @@ -193,6 +194,22 @@ public void write( BuilderReleaseDescriptor config, File file ) { properties.setProperty( "scm.commentPrefix", config.getScmCommentPrefix() ); } + if ( config.getScmDevelopmentCommitComment() != null ) + { + properties.setProperty( "scm.developmentCommitComment", config.getScmDevelopmentCommitComment() ); + } + if ( config.getScmReleaseCommitComment() != null ) + { + properties.setProperty( "scm.releaseCommitComment", config.getScmReleaseCommitComment() ); + } + if ( config.getScmBranchCommitComment() != null ) + { + properties.setProperty( "scm.branchCommitComment", config.getScmBranchCommitComment() ); + } + if ( config.getScmRollbackCommitComment() != null ) + { + properties.setProperty( "scm.rollbackCommitComment", config.getScmRollbackCommitComment() ); + } if ( config.getAdditionalArguments() != null ) { properties.setProperty( "exec.additionalArguments", config.getAdditionalArguments() ); @@ -201,6 +218,11 @@ public void write( BuilderReleaseDescriptor config, File file ) { properties.setProperty( "exec.pomFileName", config.getPomFileName() ); } + if ( !config.getActivateProfiles().isEmpty() ) + { + properties.setProperty( "exec.activateProfiles", + StringUtils.join( config.getActivateProfiles().iterator(), "," ) ); + } if ( config.getPreparationGoals() != null ) { properties.setProperty( "preparationGoals", config.getPreparationGoals() ); @@ -229,10 +251,15 @@ public void write( BuilderReleaseDescriptor config, File file ) properties.setProperty( "pushChanges", Boolean.toString( config.isPushChanges() ) ); - properties.setProperty( "autoResolveSnapshotDependencies", - Boolean.toString( config.isAutoResolveSnapshotDependencies() ) ); - properties.setProperty( "autoResolveSnapshotDependenciesMode", - Integer.toString( config.getAutoResolveSnapshotDependenciesMode() ) ); + if ( config.getWorkItem() != null ) + { + properties.setProperty( "workItem", config.getWorkItem() ); + } + + if ( config.getAutoResolveSnapshots() != null ) + { + properties.setProperty( "autoResolveSnapshots", config.getAutoResolveSnapshots() ); + } // others boolean properties are not written to the properties file because the value from the caller is always // used diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorBuilder.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorBuilder.java index 8ba0de0e0..629a897d9 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorBuilder.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseDescriptorBuilder.java @@ -56,6 +56,12 @@ public ReleaseDescriptorBuilder addCheckModificationExclude( String string ) return this; } + public ReleaseDescriptorBuilder setActivateProfiles( List profiles ) + { + releaseDescriptor.setActivateProfiles( profiles ); + return this; + } + public ReleaseDescriptorBuilder setAddSchema( boolean addSchema ) { releaseDescriptor.setAddSchema( addSchema ); @@ -200,6 +206,12 @@ public ReleaseDescriptorBuilder setPushChanges( boolean pushChanges ) return this; } + public ReleaseDescriptorBuilder setWorkItem( String workItem ) + { + releaseDescriptor.setWorkItem( workItem ); + return this; + } + public ReleaseDescriptorBuilder setReleaseStrategyId( String releaseStrategyId ) { releaseDescriptor.setReleaseStrategyId( releaseStrategyId ); @@ -224,6 +236,42 @@ public ReleaseDescriptorBuilder setScmCommentPrefix( String scmCommentPrefix ) return this; } + /** + * @since 3.0.0-M1 + */ + public ReleaseDescriptorBuilder setScmReleaseCommitComment( String scmReleaseCommitComment ) + { + releaseDescriptor.setScmReleaseCommitComment( scmReleaseCommitComment ); + return this; + } + + /** + * @since 3.0.0-M1 + */ + public ReleaseDescriptorBuilder setScmDevelopmentCommitComment( String scmDevelopmentCommitComment ) + { + releaseDescriptor.setScmDevelopmentCommitComment( scmDevelopmentCommitComment ); + return this; + } + + /** + * @since 3.0.0-M1 + */ + public ReleaseDescriptorBuilder setScmBranchCommitComment( String scmBranchCommitComment ) + { + releaseDescriptor.setScmBranchCommitComment( scmBranchCommitComment ); + return this; + } + + /** + * @since 3.0.0-M1 + */ + public ReleaseDescriptorBuilder setScmRollbackCommitComment( String scmRollbackCommitComment ) + { + releaseDescriptor.setScmRollbackCommitComment( scmRollbackCommitComment ); + return this; + } + public ReleaseDescriptorBuilder setScmId( String scmId ) { releaseDescriptor.setScmId( scmId ); @@ -392,15 +440,9 @@ public ReleaseDescriptorBuilder addDependencyDevelopmentVersion( String dependen return this; } - public ReleaseDescriptorBuilder setAutoResolveSnapshotDependencies( boolean autoResolveSnapshotDependencies ) - { - releaseDescriptor.setAutoResolveSnapshotDependencies( autoResolveSnapshotDependencies ); - return this; - } - - public ReleaseDescriptorBuilder setAutoResolveSnapshotDependenciesMode( int autoResolveSnapshotDependenciesMode ) + public ReleaseDescriptorBuilder setAutoResolveSnapshots( String autoResolveSnapshots ) { - releaseDescriptor.setAutoResolveSnapshotDependenciesMode( autoResolveSnapshotDependenciesMode ); + releaseDescriptor.setAutoResolveSnapshots( autoResolveSnapshots ); return this; } diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java index 730cdf60a..bcaf75813 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/config/ReleaseUtils.java @@ -19,6 +19,7 @@ * under the License. */ +import java.util.Arrays; import java.util.Iterator; import java.util.Map.Entry; import java.util.Properties; @@ -102,6 +103,22 @@ public static void copyPropertiesToReleaseDescriptor( Properties properties, Rel { builder.setScmCommentPrefix( properties.getProperty( "scm.commentPrefix" ) ); } + if ( properties.containsKey( "scm.developmentCommitComment" ) ) + { + builder.setScmDevelopmentCommitComment( properties.getProperty( "scm.developmentCommitComment" ) ); + } + if ( properties.containsKey( "scm.releaseCommitComment" ) ) + { + builder.setScmReleaseCommitComment( properties.getProperty( "scm.releaseCommitComment" ) ); + } + if ( properties.containsKey( "scm.branchCommitComment" ) ) + { + builder.setScmBranchCommitComment( properties.getProperty( "scm.branchCommitComment" ) ); + } + if ( properties.containsKey( "scm.rollbackCommitComment" ) ) + { + builder.setScmRollbackCommitComment( properties.getProperty( "scm.rollbackCommitComment" ) ); + } if ( properties.containsKey( "exec.additionalArguments" ) ) { builder.setAdditionalArguments( properties.getProperty( "exec.additionalArguments" ) ); @@ -110,6 +127,10 @@ public static void copyPropertiesToReleaseDescriptor( Properties properties, Rel { builder.setPomFileName( properties.getProperty( "exec.pomFileName" ) ); } + if ( properties.containsKey( "exec.activateProfiles" ) ) + { + builder.setActivateProfiles( Arrays.asList( properties.getProperty( "exec.pomFileName" ).split( "," ) ) ); + } if ( properties.containsKey( "preparationGoals" ) ) { builder.setPreparationGoals( properties.getProperty( "preparationGoals" ) ); @@ -145,15 +166,14 @@ public static void copyPropertiesToReleaseDescriptor( Properties properties, Rel String pushChanges = properties.getProperty( "pushChanges" ); builder.setPushChanges( Boolean.valueOf( pushChanges ) ); } - if ( properties.containsKey( "autoResolveSnapshotDependencies" ) ) + if ( properties.containsKey( "workItem" ) ) { - String resolve = properties.getProperty( "autoResolveSnapshotDependencies" ); - builder.setAutoResolveSnapshotDependencies( Boolean.valueOf( resolve ) ); + builder.setWorkItem( properties.getProperty( "workItem" ) ); } - if ( properties.containsKey( "autoResolveSnapshotDependenciesMode" ) ) + if ( properties.containsKey( "autoResolveSnapshots" ) ) { - String mode = properties.getProperty( "autoResolveSnapshotDependenciesMode" ); - builder.setAutoResolveSnapshotDependenciesMode( Integer.parseInt( mode ) ); + String resolve = properties.getProperty( "autoResolveSnapshots" ); + builder.setAutoResolveSnapshots( resolve ); } loadResolvedDependencies( properties, builder ); @@ -173,6 +193,16 @@ else if ( property.startsWith( "project.dev." ) ) builder.addDevelopmentVersion( property.substring( "project.dev.".length() ), properties.getProperty( property ) ); } + else if ( property.startsWith( "dependency.rel." ) ) + { + builder.addDependencyReleaseVersion( property.substring( "dependency.rel.".length() ), + properties.getProperty( property ) ); + } + else if ( property.startsWith( "dependency.dev." ) ) + { + builder.addDependencyDevelopmentVersion( property.substring( "dependency.dev.".length() ), + properties.getProperty( property ) ); + } else if ( property.startsWith( "project.scm." ) ) { int index = property.lastIndexOf( '.' ); diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java index 6b1dfc2d6..4da819909 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRewritePomsPhase.java @@ -20,11 +20,15 @@ */ import java.io.File; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.TimeZone; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; @@ -105,6 +109,13 @@ public void setModelETL( String modelETL ) this.modelETL = modelETL; } + private long startTime = -1 * 1000; + + public void setStartTime( long startTime ) + { + this.startTime = startTime; + } + protected abstract String getPomSuffix(); @Override @@ -166,6 +177,8 @@ private void transform( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment List reactorProjects, boolean simulate, ReleaseResult result ) throws ReleaseExecutionException, ReleaseFailureException { + result.setStartTime( ( startTime >= 0 ) ? startTime : System.currentTimeMillis() ); + for ( MavenProject project : reactorProjects ) { logInfo( result, "Transforming '" + project.getName() + "'..." ); @@ -325,6 +338,40 @@ private void transformDocument( MavenProject project, Model modelTarget, Release } transformScm( project, modelTarget, releaseDescriptor, projectId, scmRepository, result ); + + if ( properties != null ) + { + rewriteBuildOutputTimestampProperty( properties, result ); + } + } + + private void rewriteBuildOutputTimestampProperty( Properties properties, ReleaseResult result ) + { + String buildOutputTimestamp = properties.getProperty( "project.build.outputTimestamp" ); + if ( buildOutputTimestamp == null ) + { + // no Reproducible Builds output timestamp defined + return; + } + if ( buildOutputTimestamp.length() <= 1 ) + { + // value length == 1 means disable Reproducible Builds + return; + } + + if ( StringUtils.isNumeric( buildOutputTimestamp ) ) + { + // int representing seconds since the epoch, like SOURCE_DATE_EPOCH + buildOutputTimestamp = String.valueOf( result.getStartTime() / 1000 ); + } + else + { + // ISO-8601 + DateFormat df = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'" ); + df.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); + buildOutputTimestamp = df.format( new Date( result.getStartTime() ) ); + } + properties.setProperty( "project.build.outputTimestamp", buildOutputTimestamp ); } private void rewriteVersion( Model modelTarget, ReleaseDescriptor releaseDescriptor, String projectId, diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRunGoalsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRunGoalsPhase.java index 214f86b03..23d4cce71 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRunGoalsPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractRunGoalsPhase.java @@ -97,6 +97,24 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnviro protected abstract String getGoals( ReleaseDescriptor releaseDescriptor ); + protected String getAdditionalArguments( ReleaseDescriptor releaseDescriptor ) + { + StringBuilder builder = new StringBuilder(); + + if ( releaseDescriptor.getAdditionalArguments() != null ) + { + builder.append( releaseDescriptor.getAdditionalArguments() ); + } + + if ( !releaseDescriptor.getActivateProfiles().isEmpty() ) + { + builder.append( " -P " ) + .append( StringUtils.join( releaseDescriptor.getActivateProfiles().iterator(), "," ) ); + } + + return builder.length() > 0 ? builder.toString().trim() : null; + } + /** * Determines the path of the working directory. By default, this is the * checkout directory. For some SCMs, the project root directory is not the diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java index b36d69215..3ae72acab 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/AbstractScmCommitPhase.java @@ -39,7 +39,6 @@ import org.apache.maven.shared.release.util.ReleaseUtil; import java.io.File; -import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -63,9 +62,9 @@ public abstract class AbstractScmCommitPhase protected ScmRepositoryConfigurator scmRepositoryConfigurator; /** - * The format for the commit message. + * The getter in the descriptor for the comment. */ - protected String messageFormat; + protected String descriptorCommentGetter; @Override public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, @@ -118,6 +117,8 @@ protected void performCheckins( ReleaseDescriptor releaseDescriptor, ReleaseEnvi repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() ); + repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() ); + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); } catch ( ScmRepositoryException e ) @@ -188,10 +189,47 @@ protected void validateConfiguration( ReleaseDescriptor releaseDescriptor ) } } - protected String createMessage( ReleaseDescriptor releaseDescriptor ) + protected String createMessage( List reactorProjects, + ReleaseDescriptor releaseDescriptor ) + throws ReleaseExecutionException { - return MessageFormat.format( releaseDescriptor.getScmCommentPrefix() + messageFormat, - new Object[]{releaseDescriptor.getScmReleaseLabel()} ); + String comment; + boolean branch = false; + if ( "getScmReleaseCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmReleaseCommitComment(); + } + else if ( "getScmDevelopmentCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmDevelopmentCommitComment(); + } + else if ( "getScmBranchCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmBranchCommitComment(); + branch = true; + } + else if ( "getScmRollbackCommitComment".equals( descriptorCommentGetter ) ) + { + comment = releaseDescriptor.getScmRollbackCommitComment(); + } + else + { + throw new ReleaseExecutionException( "Invalid configuration in components-fragment.xml" ); + } + + MavenProject project = ReleaseUtil.getRootProject( reactorProjects ); + comment = comment.replace( "@{prefix}", releaseDescriptor.getScmCommentPrefix().trim() ); + comment = comment.replace( "@{groupId}", project.getGroupId() ); + comment = comment.replace( "@{artifactId}", project.getArtifactId() ); + if ( branch ) + { + comment = comment.replace( "@{branchName}", releaseDescriptor.getScmReleaseLabel() ); + } + else + { + comment = comment.replace( "@{releaseLabel}", releaseDescriptor.getScmReleaseLabel() ); + } + return comment; } protected static List createPomFiles( ReleaseDescriptor releaseDescriptor, MavenProject project ) diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java index fca83b2cd..55821c083 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/CheckDependencySnapshotsPhase.java @@ -123,7 +123,7 @@ private void checkProject( MavenProject project, ReleaseDescriptor releaseDescri } } - Set dependencyArtifacts = project.getArtifacts(); + Set dependencyArtifacts = project.getDependencyArtifacts(); usedSnapshotDependencies.addAll( checkDependencies( releaseDescriptor, artifactMap, dependencyArtifacts ) ); //@todo check dependencyManagement @@ -144,9 +144,7 @@ private void checkProject( MavenProject project, ReleaseDescriptor releaseDescri if ( !usedSnapshotDependencies.isEmpty() || !usedSnapshotReports.isEmpty() || !usedSnapshotExtensions.isEmpty() || !usedSnapshotPlugins.isEmpty() ) { - if ( releaseDescriptor.isInteractive() - || ( releaseDescriptor.isAutoResolveSnapshotDependencies() - && releaseDescriptor.getAutoResolveSnapshotDependenciesMode() >= 0 ) ) + if ( releaseDescriptor.isInteractive() || null != releaseDescriptor.getAutoResolveSnapshots() ) { resolveSnapshots( usedSnapshotDependencies, usedSnapshotReports, usedSnapshotExtensions, usedSnapshotPlugins, releaseDescriptor ); @@ -307,20 +305,25 @@ private static Artifact getArtifactFromMap( Artifact artifact, Map= 0; + bannedVersion = artifact.getVersion().indexOf( Artifact.SNAPSHOT_VERSION ) >= 0; } - return result; + return bannedVersion; } @Override @@ -362,14 +365,14 @@ private void resolveSnapshots( Set projectDependencies, Set { try { - boolean autoResolveSnapshots = releaseDescriptor.isAutoResolveSnapshotDependencies(); + String autoResolveSnapshots = releaseDescriptor.getAutoResolveSnapshots(); if ( resolveSnapshot == null ) { prompter.showMessage( RESOLVE_SNAPSHOT_MESSAGE ); - if ( autoResolveSnapshots ) + if ( autoResolveSnapshots != null ) { resolveSnapshot = "yes"; - prompter.showMessage( RESOLVE_SNAPSHOT_MESSAGE + " " + resolveSnapshot ); + prompter.showMessage( RESOLVE_SNAPSHOT_PROMPT + " " + resolveSnapshot ); } else { @@ -382,11 +385,45 @@ private void resolveSnapshots( Set projectDependencies, Set if ( resolveSnapshotType == null ) { prompter.showMessage( RESOLVE_SNAPSHOT_TYPE_MESSAGE ); - int answer = releaseDescriptor.getAutoResolveSnapshotDependenciesMode(); - if ( autoResolveSnapshots && answer >= 0 ) + int defaultAnswer = -1; + if ( autoResolveSnapshots != null ) + { + if ( "all".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 0; + } + else if ( "dependencies".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 1; + } + else if ( "plugins".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 2; + } + else if ( "reports".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 3; + } + else if ( "extensions".equalsIgnoreCase( autoResolveSnapshots ) ) + { + defaultAnswer = 4; + } + else + { + try + { + defaultAnswer = Integer.parseInt( autoResolveSnapshots ); + } + catch ( NumberFormatException e ) + { + throw new ReleaseExecutionException( e.getMessage(), e ); + } + } + } + if ( defaultAnswer >= 0 && defaultAnswer <= 4 ) { - prompter.showMessage( RESOLVE_SNAPSHOT_TYPE_MESSAGE + " " + answer ); - resolveSnapshotType = Integer.toString( answer ); + prompter.showMessage( RESOLVE_SNAPSHOT_TYPE_PROMPT + " " + autoResolveSnapshots ); + resolveSnapshotType = Integer.toString( defaultAnswer ); } else { @@ -436,7 +473,7 @@ private void resolveSnapshots( Set projectDependencies, Set } private void processSnapshot( Set snapshotSet, ReleaseDescriptor releaseDescriptor, - boolean autoResolveSnapshots ) + String autoResolveSnapshots ) throws PrompterException, VersionParseException { Iterator iterator = snapshotSet.iterator(); @@ -453,7 +490,7 @@ private void processSnapshot( Set snapshotSet, ReleaseDescriptor relea "Dependency '" + versionlessKey + "' is a snapshot (" + currentArtifact.getVersion() + ")\n" ); String message = "Which release version should it be set to?"; String result; - if ( autoResolveSnapshots ) + if ( null != autoResolveSnapshots ) { result = versionInfo.getReleaseVersionString(); prompter.showMessage( message + " " + result ); @@ -482,7 +519,7 @@ private void processSnapshot( Set snapshotSet, ReleaseDescriptor relea } message = "What version should the dependency be reset to for development?"; - if ( autoResolveSnapshots ) + if ( null != autoResolveSnapshots ) { result = nextVersion; prompter.showMessage( message + " " + result ); @@ -495,4 +532,4 @@ private void processSnapshot( Set snapshotSet, ReleaseDescriptor relea releaseDescriptor.addDependencyDevelopmentVersion( versionlessKey, result ); } } -} \ No newline at end of file +} diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveScmTagPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveScmTagPhase.java index 485ca03b9..25e031496 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveScmTagPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RemoveScmTagPhase.java @@ -19,6 +19,7 @@ * under the License. */ +import java.io.File; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.release.ReleaseExecutionException; import org.apache.maven.shared.release.ReleaseFailureException; @@ -28,26 +29,106 @@ import org.codehaus.plexus.component.annotations.Component; import java.util.List; +import org.apache.maven.scm.CommandParameter; +import org.apache.maven.scm.CommandParameters; +import org.apache.maven.scm.ScmException; +import org.apache.maven.scm.ScmFileSet; +import org.apache.maven.scm.command.untag.UntagScmResult; +import org.apache.maven.scm.manager.NoSuchScmProviderException; +import org.apache.maven.scm.provider.ScmProvider; +import org.apache.maven.scm.repository.ScmRepository; +import org.apache.maven.scm.repository.ScmRepositoryException; +import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; +import org.apache.maven.shared.release.scm.ScmRepositoryConfigurator; +import org.apache.maven.shared.release.util.ReleaseUtil; +import org.codehaus.plexus.component.annotations.Requirement; /** - * @author Edwin Punzalan + * Remove tag from SCM repository during rollback */ @Component( role = ReleasePhase.class, hint = "remove-scm-tag" ) public class RemoveScmTagPhase extends AbstractReleasePhase { + /** + * Tool that gets a configured SCM repository from release configuration. + */ + @Requirement + private ScmRepositoryConfigurator scmRepositoryConfigurator; + @Override public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, List reactorProjects ) throws ReleaseExecutionException, ReleaseFailureException { - ReleaseResult result = new ReleaseResult(); + ReleaseResult releaseResult = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + logInfo( releaseResult, "Removing tag with the label " + releaseDescriptor.getScmReleaseLabel() + " ..." ); + + ReleaseDescriptor basedirAlignedReleaseDescriptor = + ReleaseUtil.createBasedirAlignedReleaseDescriptor( releaseDescriptor, reactorProjects ); + + ScmRepository repository; + ScmProvider provider; + try + { + repository = + scmRepositoryConfigurator.getConfiguredRepository( basedirAlignedReleaseDescriptor.getScmSourceUrl(), + releaseDescriptor, + releaseEnvironment.getSettings() ); + + repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() ); + + repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() ); + + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); + } + catch ( ScmRepositoryException e ) + { + throw new ReleaseScmRepositoryException( e.getMessage(), e.getValidationMessages() ); + } + catch ( NoSuchScmProviderException e ) + { + throw new ReleaseExecutionException( "Unable to configure SCM repository: " + e.getMessage(), e ); + } + + UntagScmResult untagScmResult; + try + { + ScmFileSet fileSet = new ScmFileSet( new File( basedirAlignedReleaseDescriptor.getWorkingDirectory() ) ); + String tagName = releaseDescriptor.getScmReleaseLabel(); + String message = releaseDescriptor.getScmCommentPrefix() + "remove tag " + tagName; + CommandParameters commandParameters = new CommandParameters(); + commandParameters.setString( CommandParameter.TAG_NAME, tagName ); + commandParameters.setString( CommandParameter.MESSAGE, message ); + if ( getLogger().isDebugEnabled() ) + { + getLogger().debug( + "RemoveScmTagPhase :: scmUntagParameters tagName " + tagName ); + getLogger().debug( + "RemoveScmTagPhase :: scmUntagParameters message " + message ); + getLogger().debug( + "RemoveScmTagPhase :: fileSet " + fileSet ); + } + untagScmResult = provider.untag( repository, fileSet, commandParameters ); + } + catch ( ScmException e ) + { + throw new ReleaseExecutionException( "An error has occurred in the remove tag process: " + + e.getMessage(), e ); + } - // TODO [!]: implement + if ( !untagScmResult.isSuccess() ) + { + getLogger().warn( String.format( "Unable to remove tag%nProvider message: %s%nCommand output: %s", + untagScmResult.getProviderMessage(), untagScmResult.getCommandOutput() ) ); + } - result.setResultCode( ReleaseResult.SUCCESS ); + releaseResult.setResultCode( ReleaseResult.SUCCESS ); - return result; + return releaseResult; } @Override @@ -55,6 +136,25 @@ public ReleaseResult simulate( ReleaseDescriptor releaseDescriptor, ReleaseEnvir List reactorProjects ) throws ReleaseExecutionException, ReleaseFailureException { - return execute( releaseDescriptor, releaseEnvironment, reactorProjects ); + ReleaseResult releaseResult = new ReleaseResult(); + + validateConfiguration( releaseDescriptor ); + + logInfo( releaseResult, "Full run would remove tag with label: '" + releaseDescriptor.getScmReleaseLabel() + + "'" ); + + releaseResult.setResultCode( ReleaseResult.SUCCESS ); + + return releaseResult; } + + private void validateConfiguration( ReleaseDescriptor releaseDescriptor ) + throws ReleaseFailureException + { + if ( releaseDescriptor.getScmReleaseLabel() == null ) + { + throw new ReleaseFailureException( "A release label is required for removal" ); + } + } + } diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhase.java index 76b383412..aab47500d 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunCompleteGoalsPhase.java @@ -45,7 +45,7 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnviro throws ReleaseExecutionException { return execute( releaseDescriptor, releaseEnvironment, new File( releaseDescriptor.getWorkingDirectory() ), - releaseDescriptor.getAdditionalArguments() ); + getAdditionalArguments( releaseDescriptor ) ); } @Override diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java index 9801c1291..0d7af6520 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPerformGoalsPhase.java @@ -52,7 +52,7 @@ private ReleaseResult runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvi List reactorProjects, boolean simulate ) throws ReleaseExecutionException { - String additionalArguments = releaseDescriptor.getAdditionalArguments(); + String additionalArguments = getAdditionalArguments( releaseDescriptor ); if ( releaseDescriptor.isUseReleaseProfile() ) { diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhase.java index 860421996..23db790b5 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/RunPrepareGoalsPhase.java @@ -44,7 +44,7 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnviro throws ReleaseExecutionException { return execute( releaseDescriptor, releaseEnvironment, new File( releaseDescriptor.getWorkingDirectory() ), - releaseDescriptor.getAdditionalArguments() ); + getAdditionalArguments( releaseDescriptor ) ); } @Override diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmBranchPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmBranchPhase.java index 218a529e8..d1d85b667 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmBranchPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmBranchPhase.java @@ -84,6 +84,8 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnviro repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() ); + repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() ); + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); } diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java index 5e81186bb..c81889e7e 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitDevelopmentPhase.java @@ -79,13 +79,13 @@ protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment else { // a normal commit - message = createMessage( releaseDescriptor ); + message = createMessage( reactorProjects, releaseDescriptor ); } if ( simulating ) { Collection pomFiles = createPomFiles( releaseDescriptor, reactorProjects ); logInfo( result, - "Full run would be commit " + pomFiles.size() + " files with message: '" + message + "'" ); + "Full run would commit " + pomFiles.size() + " files with message: '" + message + "'" ); } else { diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java index 2e8d776c8..1bee2fb41 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmCommitPreparationPhase.java @@ -28,7 +28,6 @@ import org.apache.maven.shared.release.scm.ReleaseScmCommandException; import org.apache.maven.shared.release.scm.ReleaseScmRepositoryException; -import java.text.MessageFormat; import java.util.List; /** @@ -40,12 +39,6 @@ public class ScmCommitPreparationPhase extends AbstractScmCommitPhase { - /** - * The format for the - */ - private String rollbackMessageFormat; - - @Override protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment releaseEnvironment, List reactorProjects, ReleaseResult result, boolean simulating ) throws ReleaseScmCommandException, ReleaseExecutionException, ReleaseScmRepositoryException @@ -66,8 +59,7 @@ protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment // commit development versions required else { - String message = createMessage( releaseDescriptor ); - + String message = createMessage( reactorProjects, releaseDescriptor ); if ( simulating ) { simulateCheckins( releaseDescriptor, reactorProjects, result, message ); @@ -79,13 +71,6 @@ protected void runLogic( ReleaseDescriptor releaseDescriptor, ReleaseEnvironment } } - private String createRollbackMessage( ReleaseDescriptor releaseDescriptor ) - { - return MessageFormat.format( releaseDescriptor.getScmCommentPrefix() + rollbackMessageFormat, - new Object[]{releaseDescriptor.getScmReleaseLabel()} ); - } - - @Override protected void validateConfiguration( ReleaseDescriptor releaseDescriptor ) throws ReleaseFailureException { diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java index 8a62f555b..5f52d3926 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/ScmTagPhase.java @@ -97,6 +97,8 @@ public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, ReleaseEnviro repository.getProviderRepository().setPushChanges( releaseDescriptor.isPushChanges() ); + repository.getProviderRepository().setWorkItem( releaseDescriptor.getWorkItem() ); + provider = scmRepositoryConfigurator.getRepositoryProvider( repository ); } catch ( ScmRepositoryException e ) diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETL.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETL.java index 9aef4cf98..49df5abb8 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETL.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomModelETL.java @@ -195,7 +195,7 @@ private void writePom( File pomFile, Document document, ReleaseDescriptor releas if ( rootElement.getAttribute( "schemaLocation", xsiNamespace ) == null ) { rootElement.setAttribute( "schemaLocation", "http://maven.apache.org/POM/" + modelVersion - + " http://maven.apache.org/maven-v" + modelVersion.replace( '.', '_' ) + ".xsd", xsiNamespace ); + + " https://maven.apache.org/xsd/maven-" + modelVersion + ".xsd", xsiNamespace ); } // the empty namespace is considered equal to the POM namespace, so match them up to avoid extra xmlns="" diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPlugin.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPlugin.java index 65c8fdbfd..2955ddcac 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPlugin.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomPlugin.java @@ -180,7 +180,7 @@ public void flushExecutionMap() } @Override - public Map getExecutionsAsMap() + public Map getExecutionsAsMap() { throw new UnsupportedOperationException(); } diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReportPlugin.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReportPlugin.java index 696a0f514..40a82b75b 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReportPlugin.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReportPlugin.java @@ -134,7 +134,7 @@ public void flushReportSetMap() } @Override - public Map getReportSetsAsMap() + public Map getReportSetsAsMap() { throw new UnsupportedOperationException(); } diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReporting.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReporting.java index c7d723ca4..88963033b 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReporting.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/transform/jdom/JDomReporting.java @@ -104,7 +104,7 @@ public void flushReportPluginMap() } @Override - public Map getReportPluginsAsMap() + public Map getReportPluginsAsMap() { throw new UnsupportedOperationException(); } diff --git a/maven-release-manager/src/main/mdo/release-descriptor.mdo b/maven-release-manager/src/main/mdo/release-descriptor.mdo index 44c833574..6bf44f2ca 100644 --- a/maven-release-manager/src/main/mdo/release-descriptor.mdo +++ b/maven-release-manager/src/main/mdo/release-descriptor.mdo @@ -68,6 +68,42 @@ The prefix of SCM modification messages + + scmReleaseCommitComment + 3.0.0+ + String + @{prefix} prepare release @{releaseLabel} + + The SCM commit comment when setting pom.xml to release + + + + scmDevelopmentCommitComment + 3.0.0+ + String + @{prefix} prepare for next development iteration + + The SCM commit comment when setting pom.xml back to development + + + + scmBranchCommitComment + 3.0.0+ + String + @{prefix} prepare branch @{releaseLabel} + + The SCM commit comment when branching + + + + scmRollbackCommitComment + 3.0.0+ + String + @{prefix} rollback the release of @{releaseLabel} + + The SCM commit comment when rolling back + + scmSourceUrl 1.0.0+ @@ -217,18 +253,16 @@ If set to true, this will set the property "performRelease" to true. - - - - - - - - - - - - + + activateProfiles + 3.0.0+ + List + + String + * + + List of profiles to activate. + workingDirectory 1.0.0+ @@ -519,28 +553,36 @@ - autoResolveSnapshotDependencies + workItem 3.0.0+ - boolean - false + String - Specifies whether unresolved SNAPSHOT dependencies are automatically resolved. - If this is set to "true", then the default values for the dependency's - release and next development version are used. + Some SCMs may require a Work Item or a Task to allow the changes to be pushed or delivered. + This field allows you to specify that Work Item or Task. It is optional, and only relevant + if pushChanges is true. - autoResolveSnapshotDependenciesMode + autoResolveSnapshots 3.0.0+ - int - 1 + String - This specifies the default answer to be used when unresolved SNAPSHOT - dependencies should automatically be resolved - ( 0:All 1:Project Dependencies 2:Plugins 3:Reports 4:Extensions ) + +
  • "all" or "0": resolve all kinds of snapshots, ie. project, plugin, report and extension dependencies
  • +
  • "dependencies" or "1": resolve project dependencies
  • +
  • "plugins" or "2": resolve plugin dependencies
  • +
  • "reports" or "3": resolve report dependencies
  • +
  • "extensions" or "4": resolve extension dependencies
  • + + Additionally this implies that the default values for the dependency's release and next + development version are used.]]>
    + + + + + + org.apache.maven.scm.manager.ScmManager + org.apache.maven.shared.release.stubs.ScmManagerStub + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.console.ConsoleLoggerManager + basic + + ERROR + + + + diff --git a/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies-no-reactor/pom.xml b/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies-no-reactor/pom.xml new file mode 100644 index 000000000..c62fbfabd --- /dev/null +++ b/maven-release-manager/src/test/resources/projects/check-dependencies/internal-snapshot-dependencies-no-reactor/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + groupId + artifactId + 1.0-SNAPSHOT + jar + + + + groupId + test + 1.0-SNAPSHOT + + + diff --git a/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom-with-schema.xml b/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom-with-schema.xml index 498bc85ca..a983613cf 100644 --- a/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom-with-schema.xml +++ b/maven-release-manager/src/test/resources/projects/rewrite-for-branch/basic-pom/expected-pom-with-schema.xml @@ -16,7 +16,7 @@ ~ limitations under the License. --> - + 4.0.0 groupId artifactId diff --git a/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom-with-schema.xml b/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom-with-schema.xml index 7f656c27d..495a718e3 100644 --- a/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom-with-schema.xml +++ b/maven-release-manager/src/test/resources/projects/rewrite-for-development/basic-pom/expected-pom-with-schema.xml @@ -16,7 +16,7 @@ ~ limitations under the License. --> - + 4.0.0 groupId artifactId @@ -32,6 +32,15 @@ file://localhost/tmp/scm-repo/trunk + + UTF-8 + UTF-8 + 1970-01-01T00:00:00Z + 7 + 1.${javaVersion} + 1.${javaVersion} + + - + 4.0.0 groupId artifactId @@ -32,6 +32,15 @@ file://localhost/tmp/scm-repo/tags/release-label + + UTF-8 + UTF-8 + 1970-01-01T00:00:00Z + 7 + 1.${javaVersion} + 1.${javaVersion} + + + + 4.0.0 + + test + dependency + 1.0-SNAPSHOT + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/mrm/repository/extension-1.0-SNAPSHOT.pom b/maven-release-plugin/src/it/mrm/repository/extension-1.0-SNAPSHOT.pom new file mode 100644 index 000000000..3c5f169b8 --- /dev/null +++ b/maven-release-plugin/src/it/mrm/repository/extension-1.0-SNAPSHOT.pom @@ -0,0 +1,30 @@ + + + + + 4.0.0 + + test + extension + 1.0-SNAPSHOT + + diff --git a/maven-release-plugin/src/it/mrm/repository/parent-1-SNAPSHOT.pom b/maven-release-plugin/src/it/mrm/repository/parent-1-SNAPSHOT.pom new file mode 100644 index 000000000..7f49b44c6 --- /dev/null +++ b/maven-release-plugin/src/it/mrm/repository/parent-1-SNAPSHOT.pom @@ -0,0 +1,28 @@ + + + + 4.0.0 + + test + parent + 1-SNAPSHOT + pom + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/settings.xml b/maven-release-plugin/src/it/mrm/settings.xml similarity index 91% rename from maven-release-plugin/src/it/settings.xml rename to maven-release-plugin/src/it/mrm/settings.xml index 1851c7726..4b3caf110 100644 --- a/maven-release-plugin/src/it/settings.xml +++ b/maven-release-plugin/src/it/mrm/settings.xml @@ -20,6 +20,15 @@ + + + mrm-maven-plugin + Mock Repository Manager + @mrm.repository.url@ + * + + + it-server diff --git a/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml b/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml index 0d96a82fa..2ad818e46 100644 --- a/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml +++ b/maven-release-plugin/src/it/projects/branch/MRELEASE-976/pom.xml @@ -32,7 +32,9 @@ + org.apache.maven.plugins maven-release-plugin + @project.version@ branch-mrelease-976 StubVersionPolicy diff --git a/maven-release-plugin/src/it/projects/branch/invoker.properties b/maven-release-plugin/src/it/projects/branch/invoker.properties new file mode 100644 index 000000000..0b47fed18 --- /dev/null +++ b/maven-release-plugin/src/it/projects/branch/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:branch \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/perform/MRELEASE-459/verify.groovy b/maven-release-plugin/src/it/projects/perform/MRELEASE-459/verify.groovy index 95da4d89f..b6a4bbf3b 100644 --- a/maven-release-plugin/src/it/projects/perform/MRELEASE-459/verify.groovy +++ b/maven-release-plugin/src/it/projects/perform/MRELEASE-459/verify.groovy @@ -20,7 +20,7 @@ File buildLog = new File( basedir, 'build.log' ) assert buildLog.exists() -def addArgsExpr = /\Q[DEBUG] Additional arguments: -P\E(.+)\Q-DperformRelease=true -f pom.xml\E/ +def addArgsExpr = /\Q[DEBUG] Additional arguments: \E(?:-Dhttps.protocols=TLSv1.2 )?-P(.+)\Q-DperformRelease=true -f pom.xml\E/ def matcher = ( buildLog.getText() =~ addArgsExpr ) // M2: [DEBUG] Additional arguments: -P custom-release -DperformRelease=true -f pom.xml diff --git a/maven-release-plugin/src/it/projects/perform/invoker.properties b/maven-release-plugin/src/it/projects/perform/invoker.properties new file mode 100644 index 000000000..676aa5db3 --- /dev/null +++ b/maven-release-plugin/src/it/projects/perform/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:prepare release:perform \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare-with-pom/invoker.properties b/maven-release-plugin/src/it/projects/prepare-with-pom/invoker.properties new file mode 100644 index 000000000..0f61bae72 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare-with-pom/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:prepare-with-pom \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/pom.xml new file mode 100644 index 000000000..133cb6ad5 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/pom.xml @@ -0,0 +1,96 @@ + + + + + 4.0.0 + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + This is the base POM the release test modules + pom + O2 Release test Base Module + + release-test-module-one + release-test-module-two + + + scm:git|sd_pa/tools/release-test + + + + + + org.apache.maven.plugin.release.its + release-test-module-one + 1.0-SNAPSHOT + + + + org.apache.maven.plugin.release.its + release-test-module-one + 1.0-SNAPSHOT + test-jar + test + + + + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + + org.apache.maven.plugins + maven-source-plugin + + + package + + jar + + + + + + + + + o2-webdav + ${repository.o2.webdav} + + + o2-webdav + ${repository.o2.webdav} + + + + dav:${o2.module.sites.rootUrl}/${project.groupId}/${project.artifactId}-${project.version} + + + diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-one/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-one/pom.xml new file mode 100644 index 000000000..aac087037 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-one/pom.xml @@ -0,0 +1,49 @@ + + + + + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + + 4.0.0 + release-test-module-one + 1.0-SNAPSHOT + release-test-module-one + http://maven.apache.org + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-two/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-two/pom.xml new file mode 100644 index 000000000..0e494b92b --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/release-test-module-two/pom.xml @@ -0,0 +1,47 @@ + + + + + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + + 4.0.0 + release-test-module-two + release-test-module-two + 1.0-SNAPSHOT + http://maven.apache.org + + + + org.apache.maven.plugin.release.its + release-test-module-one + + + + org.apache.maven.plugin.release.its + release-test-module-one + test-jar + test + + + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/verify.groovy b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/verify.groovy new file mode 100644 index 000000000..ec4071365 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161-dependencyManagement/verify.groovy @@ -0,0 +1,29 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def projectRoot = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) + +assert projectRoot.dependencyManagement.dependencies.dependency[0].version.text() == "1.1-SNAPSHOT" +assert projectRoot.dependencyManagement.dependencies.dependency[1].version.text() == "1.1-SNAPSHOT" + +return true \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/pom.xml new file mode 100644 index 000000000..1beecc75a --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/pom.xml @@ -0,0 +1,77 @@ + + + + + 4.0.0 + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + This is the base POM the release test modules + pom + O2 Release test Base Module + + release-test-module-one + release-test-module-two + + + scm:git|sd_pa/tools/release-test + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + + org.apache.maven.plugins + maven-source-plugin + + + package + + jar + + + + + + + + + o2-webdav + ${repository.o2.webdav} + + + o2-webdav + ${repository.o2.webdav} + + + + dav:${o2.module.sites.rootUrl}/${project.groupId}/${project.artifactId}-${project.version} + + + diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-one/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-one/pom.xml new file mode 100644 index 000000000..aac087037 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-one/pom.xml @@ -0,0 +1,49 @@ + + + + + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + + 4.0.0 + release-test-module-one + 1.0-SNAPSHOT + release-test-module-one + http://maven.apache.org + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-two/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-two/pom.xml new file mode 100644 index 000000000..0a2ed5fda --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/release-test-module-two/pom.xml @@ -0,0 +1,49 @@ + + + + + org.apache.maven.plugin.release.its + mrelease-161 + 1.0-SNAPSHOT + + 4.0.0 + release-test-module-two + release-test-module-two + 1.0-SNAPSHOT + http://maven.apache.org + + + + org.apache.maven.plugin.release.its + release-test-module-one + 1.0-SNAPSHOT + + + + org.apache.maven.plugin.release.its + release-test-module-one + 1.0-SNAPSHOT + test-jar + test + + + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/verify.groovy b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/verify.groovy new file mode 100644 index 000000000..3718c5488 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-161/verify.groovy @@ -0,0 +1,29 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def projectRoot = new XmlSlurper().parse( new File( basedir, "release-test-module-two/pom.xml.next" ) ) + +assert projectRoot.dependencies.dependency[0].version.text() == "1.1-SNAPSHOT" +assert projectRoot.dependencies.dependency[1].version.text() == "1.1-SNAPSHOT" + +return true \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/verify.groovy b/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/verify.groovy index 787aa8f06..e0839d3dc 100644 --- a/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/verify.groovy +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-571_M3/verify.groovy @@ -21,7 +21,7 @@ File releaseProperties = new File( basedir, 'release.properties' ) assert releaseProperties.exists() def String execArgs = releaseProperties.filterLine { line -> - line.startsWith( 'exec.additionalArguments=' ) + line.startsWith( 'exec.activateProfiles=' ) } -assert execArgs.contains( "-P mrelease571" ) +assert execArgs.contains( "mrelease571" ) diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/pom.xml index a5b3b1cfe..216c5555c 100644 --- a/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/pom.xml +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-667/pom.xml @@ -37,7 +37,7 @@ - -Prelease,!mrelease-677 + -Prelease,!mrelease-677 ${arguments} help:all-profiles diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/pom.xml new file mode 100644 index 000000000..38bd07e29 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.maven.plugins.release.its + mrelease-835 + 1.0-SNAPSHOT + pom + + + scm:dummy|nul + scm:dummy|nul + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + dependencies + -Dflag -Dfoo=bar + invoker + validate + validate + verify + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + + + + test + dependency + 1.2.3-SNAPSHOT + + + test + dependency.test + 2.3.4-SNAPSHOT + test + + + diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/verify.groovy b/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/verify.groovy new file mode 100644 index 000000000..027cc503b --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-835/verify.groovy @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +assert 1 == buildLog.getText().count("[DEBUG] (f) autoResolveSnapshots = dependencies") + +File pomXmlNext = new File( basedir, 'pom.xml.next' ) +assert pomXmlNext.exists() +assert 1 == pomXmlNext.getText().count("1.2.3") +assert 1 == pomXmlNext.getText().count("2.3.4") diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/verify.groovy b/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/verify.groovy index 7d0ba68ad..a39cde10c 100644 --- a/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/verify.groovy +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-966/verify.groovy @@ -21,7 +21,7 @@ File buildLog = new File( basedir, 'build.log' ) assert buildLog.exists() -assert 3 == buildLog.getText().count("[INFO] Building mrelease-966-my-pom 1.0-SNAPSHOT") +assert 2 == buildLog.getText().count("[INFO] Building mrelease-966-my-pom 1.0-SNAPSHOT") assert 0 == buildLog.getText().count("[INFO] Building mrelease-966-pom 1.0-SNAPSHOT") assert 1 == buildLog.getText().count("[INFO] [INFO] Building mrelease-966-my-pom 1.0-SNAPSHOT") assert 1 == buildLog.getText().count("[DEBUG] Specified POM file is not named 'pom.xml'. Using the '-f' command-line option to accommodate non-standard filename...") diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml index af0c72687..a20e7d116 100644 --- a/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-976/pom.xml @@ -32,7 +32,9 @@ + org.apache.maven.plugins maven-release-plugin + @project.version@ StubVersionPolicy diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/pom.xml b/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/pom.xml new file mode 100644 index 000000000..284c0f58f --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + + test + parent + 1-SNAPSHOT + + + org.apache.maven.plugin.release.its + mrelease-985 + 1.0-SNAPSHOT + + + scm:dummy|nul + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + scm:dummy|nul + perform_username + perform_password + + + + + + + + test + dependency + 1.0-SNAPSHOT + + + \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/test.properties b/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/test.properties new file mode 100644 index 000000000..7d79cfc30 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/test.properties @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +dependency.rel.test\:parent=1 +dependency.dev.test\:parent=2-SNAPSHOT +dependency.rel.test\:dependency=1.0.RELEASE +dependency.dev.test\:dependency=2.0-SNAPSHOT diff --git a/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/verify.groovy b/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/verify.groovy new file mode 100644 index 000000000..4e05fc8f7 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/MRELEASE-985/verify.groovy @@ -0,0 +1,36 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) ) +assert project.version.text() == "1.0-SNAPSHOT" +assert project.parent.version.text() == "1-SNAPSHOT" +assert project.dependencies.dependency.version.text() == "1.0-SNAPSHOT" + +def projectTag = new XmlSlurper().parse( new File( basedir, "pom.xml.tag" ) ) +assert projectTag.version.text() == "1.0" +assert projectTag.parent.version.text() == "1" +assert projectTag.dependencies.dependency.version.text() == "1.0.RELEASE" + +def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) +assert projectNext.version.text() == "1.1-SNAPSHOT" +assert projectNext.parent.version.text() == "2-SNAPSHOT" +assert projectNext.dependencies.dependency.version.text() == "2.0-SNAPSHOT" + +return true diff --git a/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/invoker.properties b/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/invoker.properties new file mode 100644 index 000000000..c19c7116f --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.buildResult = failure \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/pom.xml b/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/pom.xml new file mode 100644 index 000000000..317f36abf --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/pom.xml @@ -0,0 +1,97 @@ + + + + 4.0.0 + + org.apache.maven.plugins.release.its + fail-on-snapshot + 1.0-SNAPSHOT + pom + + + scm:dummy|nul + scm:dummy|nul + + + + + + test + extension + 1.0-SNAPSHOT + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + -Dflag -Dfoo=bar + invoker + validate + validate + verify + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + test + plugin + 1.0-SNAPSHOT + + + org.apache.maven.plugins + maven-install-plugin + 3.0.0 + + + + + + + test + dependency + 1.0-SNAPSHOT + + + test + dependency.test + 1.0-SNAPSHOT + test + + + + + + + test + report + 1.0-SNAPSHOT + + + + diff --git a/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/verify.groovy b/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/verify.groovy new file mode 100644 index 000000000..7bc9f5fb9 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/fail-on-snapshots/verify.groovy @@ -0,0 +1,32 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def buildLog = new File(basedir,'build.log') +def nonReleased = buildLog.readLines() + .dropWhile{ !it.endsWith("Can't release project due to non released dependencies :") } + .drop(1) + .collect{ (it - '[ERROR]').trim() } + .takeWhile{ !it.startsWith("in project 'fail-on-snapshot'") } as Set + +assert nonReleased == ['test:dependency:jar:1.0-SNAPSHOT:compile', + 'test:dependency.test:jar:1.0-SNAPSHOT:test', + 'test:extension:jar:1.0-SNAPSHOT', + 'test:plugin:maven-plugin:1.0-SNAPSHOT:runtime', + 'test:report:maven-plugin:1.0-SNAPSHOT:runtime'] as Set \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/pom.xml b/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/pom.xml index bd7ae9501..8c27df667 100644 --- a/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/pom.xml +++ b/maven-release-plugin/src/it/projects/prepare/flat-multi-module/parent-project/pom.xml @@ -35,6 +35,18 @@ @maven.compiler.target@ + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + junit diff --git a/maven-release-plugin/src/it/projects/prepare/invoker.properties b/maven-release-plugin/src/it/projects/prepare/invoker.properties new file mode 100644 index 000000000..43b6c5fcb --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:prepare \ No newline at end of file diff --git a/maven-release-plugin/src/it/projects/prepare/namespace/pom.xml b/maven-release-plugin/src/it/projects/prepare/namespace/pom.xml new file mode 100644 index 000000000..3fee1089a --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/namespace/pom.xml @@ -0,0 +1,60 @@ + + + + 4.0.0 + + org.apache.maven.its.release + completion-goals + 1.0-SNAPSHOT + pom + + Verify that schemaLocation keeps its original value + + Maven Release Plugin IT + http://maven.apache.org/ + + + scm:dummy|nul + scm:dummy|nul + + + + + + maven-release-plugin + @project.version@ + + -Dflag -Dfoo=bar + invoker + validate + validate + verify + + + + org.apache.maven.its.release + maven-scm-provider-dummy + 1.0 + + + + + + diff --git a/maven-release-plugin/src/it/projects/prepare/namespace/verify.groovy b/maven-release-plugin/src/it/projects/prepare/namespace/verify.groovy new file mode 100644 index 000000000..da22596b3 --- /dev/null +++ b/maven-release-plugin/src/it/projects/prepare/namespace/verify.groovy @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def project = new XmlSlurper().parse( new File( basedir, "pom.xml" ) ) +assert project['@xsi:schemaLocation'] == "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd" + +def projectTag = new XmlSlurper().parse( new File( basedir, "pom.xml.tag" ) ) +assert projectTag['@xsi:schemaLocation'] == "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd" + +def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) ) +assert projectNext['@xsi:schemaLocation'] == "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd" + +return true diff --git a/maven-release-plugin/src/it/projects/prepare/regular-multi-module/pom.xml b/maven-release-plugin/src/it/projects/prepare/regular-multi-module/pom.xml index 921338632..083c8df6a 100644 --- a/maven-release-plugin/src/it/projects/prepare/regular-multi-module/pom.xml +++ b/maven-release-plugin/src/it/projects/prepare/regular-multi-module/pom.xml @@ -34,6 +34,19 @@ @maven.compiler.source@ @maven.compiler.target@ + + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + junit diff --git a/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/pom.xml b/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/pom.xml index c659fa24f..4718e3d4b 100644 --- a/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/pom.xml +++ b/maven-release-plugin/src/it/projects/update-versions/MRELEASE-555/pom.xml @@ -26,6 +26,18 @@ http://jira.codehaus.org/browse/MRELEASE-555 + + + + + org.apache.maven.plugins + maven-release-plugin + @project.version@ + + + + + module-a module-b diff --git a/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml b/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml index b42f0f261..fc9693f7a 100644 --- a/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml +++ b/maven-release-plugin/src/it/projects/update-versions/MRELEASE-976/pom.xml @@ -28,7 +28,9 @@ + org.apache.maven.plugins maven-release-plugin + @project.version@ StubVersionPolicy diff --git a/maven-release-plugin/src/it/projects/update-versions/invoker.properties b/maven-release-plugin/src/it/projects/update-versions/invoker.properties new file mode 100644 index 000000000..a567a5836 --- /dev/null +++ b/maven-release-plugin/src/it/projects/update-versions/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = release:clean release:update-versions \ No newline at end of file diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java index 4f05d2db1..5a4ded431 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractReleaseMojo.java @@ -22,7 +22,8 @@ import java.io.File; import java.io.IOException; import java.nio.file.Path; -import java.util.Iterator; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.apache.maven.artifact.ArtifactUtils; @@ -134,7 +135,7 @@ public abstract class AbstractReleaseMojo private String releaseStrategyId; /** - * Gets the enviroment settings configured for this release. + * Gets the environment settings configured for this release. * * @return The release environment, never null. */ @@ -185,46 +186,22 @@ protected ReleaseDescriptorBuilder createReleaseDescriptor() descriptor.putOriginalVersion( versionlessKey, project.getVersion() ); } - for ( MavenProject project : reactorProjects ) - { - String versionlessKey = ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ); - descriptor.putOriginalVersion( versionlessKey, project.getVersion() ); - } + descriptor.setAdditionalArguments( this.arguments ); List profileIds = session.getRequest().getActiveProfiles(); String additionalProfiles = getAdditionalProfiles(); - String args = this.arguments; if ( !profileIds.isEmpty() || StringUtils.isNotBlank( additionalProfiles ) ) { - if ( !StringUtils.isEmpty( args ) ) - { - args += " -P "; - } - else - { - args = "-P "; - } - - for ( Iterator it = profileIds.iterator(); it.hasNext(); ) - { - args += it.next(); - if ( it.hasNext() ) - { - args += ","; - } - } - + List profiles = new ArrayList<>( profileIds ); + if ( additionalProfiles != null ) { - if ( !profileIds.isEmpty() ) - { - args += ","; - } - args += additionalProfiles; + profiles.addAll( Arrays.asList( additionalProfiles.split( "," ) ) ); } + + descriptor.setActivateProfiles( profiles ); } - descriptor.setAdditionalArguments( args ); descriptor.setReleaseStrategyId( releaseStrategyId ); diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java index d75064ea2..6804603b2 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/AbstractScmReleaseMojo.java @@ -98,7 +98,16 @@ public abstract class AbstractScmReleaseMojo private boolean pushChanges = true; /** - * Add a new or overwrite the default implementation per provider. + * A workItem for SCMs like RTC, TFS etc, that may require additional + * information to perform a pushChange operation. + * + * @since 3.0.0 + */ + @Parameter( property = "workItem" ) + private String workItem; + + /** + * Add a new or overwrite the default implementation per provider. * The key is the scm prefix and the value is the role hint of the * {@link org.apache.maven.scm.provider.ScmProvider}. * @@ -142,6 +151,7 @@ protected ReleaseDescriptorBuilder createReleaseDescriptor() descriptor.setScmCommentPrefix( scmCommentPrefix ); descriptor.setPushChanges( pushChanges ); + descriptor.setWorkItem( workItem ); if ( project.getScm() != null ) { diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java index 4378d24fa..1cbd46772 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/BranchReleaseMojo.java @@ -25,6 +25,7 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; import org.apache.maven.shared.release.ReleaseBranchRequest; import org.apache.maven.shared.release.ReleaseExecutionException; import org.apache.maven.shared.release.ReleaseFailureException; @@ -32,8 +33,8 @@ /** * Branch a project in SCM, using the same steps as the release:prepare goal, creating a branch instead of a - * tag. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/branch.html. + * tag. For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/branch.html. * * @author Emmanuel Venisse * @version $Id$ @@ -146,7 +147,7 @@ public class BranchReleaseMojo /** * currently only implemented with svn scm. Enable a workaround to prevent issue - * due to svn client > 1.5.0 (http://jira.codehaus.org/browse/SCM-406) + * due to svn client > 1.5.0 (https://issues.apache.org/jira/browse/SCM-406) * * @since 2.0 */ @@ -210,6 +211,25 @@ public class BranchReleaseMojo @Parameter( property = "projectNamingPolicyId" ) private String projectBranchNamingPolicyId; + /** + * The SCM commit comment when branching. + * Defaults to "@{prefix} prepare branch @{releaseLabel}". + *

    + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use @{...} to reference the properties rather than ${...}. + * The following properties are available: + *

      + *
    • prefix - The comment prefix. + *
    • groupId - The groupId of the root project. + *
    • artifactId - The artifactId of the root project. + *
    • releaseLabel - The release version of the root project. + *
    + * + * @since 3.0.0-M1 + */ + @Parameter( defaultValue = "@{prefix} prepare branch @{releaseLabel}", property = "scmBranchCommitComment" ) + private String scmBranchCommitComment = "@{prefix} prepare branch @{releaseLabel}"; + @Override public void execute() throws MojoExecutionException, MojoFailureException @@ -233,6 +253,7 @@ public void execute() config.setSuppressCommitBeforeTagOrBranch( suppressCommitBeforeBranch ); config.setProjectVersionPolicyId( projectVersionPolicyId ); config.setProjectNamingPolicyId( projectBranchNamingPolicyId ); + config.setScmBranchCommitComment( scmBranchCommitComment ); if ( checkModificationExcludeList != null ) { @@ -250,6 +271,7 @@ public void execute() branchRequest.setReleaseDescriptorBuilder( config ); branchRequest.setReleaseEnvironment( getReleaseEnvironment() ); branchRequest.setReactorProjects( getReactorProjects() ); + branchRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog(), dryRun ) ); branchRequest.setDryRun( dryRun ); branchRequest.setUserProperties( session.getUserProperties() ); diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java index 3de5857a8..43e34756e 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/CleanReleaseMojo.java @@ -22,6 +22,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; import org.apache.maven.shared.release.ReleaseCleanRequest; import org.apache.maven.shared.release.ReleaseFailureException; import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; @@ -30,8 +31,8 @@ * Clean up after a release preparation. This is done automatically after a successful release:perform, * so is best served for cleaning up a failed or abandoned release, or a dry run. Note that only the working copy * is cleaned up, no previous steps are rolled back. - * For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/clean-release.html. + * For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/clean-release.html. * * @author Brett Porter * @version $Id$ @@ -50,6 +51,7 @@ public void execute() ReleaseCleanRequest cleanRequest = new ReleaseCleanRequest(); cleanRequest.setReleaseDescriptorBuilder( releaseDescriptor ); cleanRequest.setReactorProjects( getReactorProjects() ); + cleanRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog() ) ); try { diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java index 9abd94f61..51636f0b2 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PerformReleaseMojo.java @@ -28,6 +28,7 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.scm.manager.ScmManager; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; import org.apache.maven.shared.release.ReleaseExecutionException; import org.apache.maven.shared.release.ReleaseFailureException; import org.apache.maven.shared.release.ReleasePerformRequest; @@ -37,8 +38,8 @@ /** * Perform a release from SCM, either from a specified tag, or the tag representing the previous release in * the working copy created by release:prepare. - * For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/perform-release.html. + * For more info see https://maven.apache.org/plugins/maven-release-plugin/examples/perform-release.html. * * @author Emmanuel Venisse * @author Brett Porter @@ -194,6 +195,7 @@ public void execute() performRequest.setReleaseDescriptorBuilder( releaseDescriptor ); performRequest.setReleaseEnvironment( getReleaseEnvironment() ); performRequest.setReactorProjects( getReactorProjects() ); + performRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog(), dryRun ) ); performRequest.setDryRun( dryRun ); releaseManager.perform( performRequest ); diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java index 25a06c5a2..9e601c026 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java @@ -25,6 +25,8 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; import org.apache.maven.shared.release.ReleaseExecutionException; import org.apache.maven.shared.release.ReleaseFailureException; import org.apache.maven.shared.release.ReleasePrepareRequest; @@ -34,8 +36,8 @@ * Prepare for a release in SCM. Steps through several phases to ensure the POM is ready to be released and then * prepares SCM to eventually contain a tagged version of the release and a record in the local copy of the parameters * used. This can be followed by a call to release:perform. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html. + * href="https://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html" + * >https://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html. * * @author John Casey * @author Emmanuel Venisse @@ -44,7 +46,7 @@ * @version $Id$ * @todo [!] check how this works with version ranges */ -@Mojo( name = "prepare", aggregator = true ) +@Mojo( name = "prepare", aggregator = true, requiresDependencyCollection = ResolutionScope.TEST ) public class PrepareReleaseMojo extends AbstractScmReleaseMojo { @@ -177,7 +179,7 @@ public class PrepareReleaseMojo * Currently only implemented with svn scm. *
      *
    • Enables a workaround to prevent issue due to svn client > 1.5.0 (fixed in 1.6.5) - * (http://jira.codehaus.org/browse/SCM-406)
    • + * (https://issues.apache.org/jira/browse/SCM-406) *
    • You may not want to use this in conjunction with suppressCommitBeforeTag, such that no poms with * released versions are committed to the working copy ever.
    • *
    @@ -239,24 +241,62 @@ public class PrepareReleaseMojo private String projectTagNamingPolicyId; /** - * Specifies whether unresolved SNAPSHOT dependencies are automatically resolved. - * If this is set to "true", then the default values for the dependency's - * release and next development version are used. - * + * The SCM commit comment when setting pom.xml to release. + * Defaults to "@{prefix} prepare release @{releaseLabel}". + *

    + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use @{...} to reference the properties rather than ${...}. + * The following properties are available: + *

      + *
    • prefix - The comment prefix. + *
    • groupId - The groupId of the root project. + *
    • artifactId - The artifactId of the root project. + *
    • releaseLabel - The release version of the root project. + *
    + * * @since 3.0.0 */ - @Parameter( defaultValue = "false", property = "autoResolveSnapshotDependencies" ) - private boolean autoResolveSnapshotDependencies; + @Parameter( defaultValue = "@{prefix} prepare release @{releaseLabel}", property = "scmReleaseCommitComment" ) + private String scmReleaseCommitComment = "@{prefix} prepare release @{releaseLabel}"; /** - * This specifies the default answer to be used when unresolved SNAPSHOT - * dependencies should automatically be resolved
    - * ( 0:All 1:Project Dependencies 2:Plugins 3:Reports 4:Extensions ) + * The SCM commit comment when setting pom.xml back to development. + * Defaults to "@{prefix} prepare for next development iteration". + *

    + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use @{...} to reference the properties rather than ${...}. + * The following properties are available: + *

      + *
    • prefix - The comment prefix. + *
    • groupId - The groupId of the root project. + *
    • artifactId - The artifactId of the root project. + *
    • releaseLabel - The release version of the root project. + *
    + * + * @since 3.0.0 + */ + @Parameter( + defaultValue = "@{prefix} prepare for next development iteration", + property = "scmDevelopmentCommitComment" ) + private String scmDevelopmentCommitComment = "@{prefix} prepare for next development iteration"; + + /** + * Specifies whether unresolved SNAPSHOT dependencies should automatically be resolved. + * If this is set, then this specifies the default answer to be used when unresolved SNAPSHOT + * dependencies should automatically be resolved ( 0:All 1:Project Dependencies 2:Plugins + * 3:Reports 4:Extensions ). Possible values are: + *
      + *
    • "all" or "0": resolve all kinds of snapshots, ie. project, plugin, report and extension dependencies
    • + *
    • "dependencies" or "1": resolve project dependencies
    • + *
    • "plugins" or "2": resolve plugin dependencis
    • + *
    • "reports" or "3": resolve report dependencies
    • + *
    • "extensions" or "4": resolve extension dependencies
    • + *
    * * @since 3.0.0 */ - @Parameter( defaultValue = "1", property = "autoResolveSnapshotDependenciesMode" ) - private int autoResolveSnapshotDependenciesMode; + @Parameter( property = "autoResolveSnapshots" ) + private String autoResolveSnapshots; /** * {@inheritDoc} @@ -300,8 +340,9 @@ protected void prepareRelease( boolean generateReleasePoms ) config.setWaitBeforeTagging( waitBeforeTagging ); config.setProjectVersionPolicyId( projectVersionPolicyId ); config.setProjectNamingPolicyId( projectTagNamingPolicyId ); - config.setAutoResolveSnapshotDependencies( autoResolveSnapshotDependencies ); - config.setAutoResolveSnapshotDependenciesMode( autoResolveSnapshotDependenciesMode ); + config.setScmDevelopmentCommitComment( scmDevelopmentCommitComment ); + config.setScmReleaseCommitComment( scmReleaseCommitComment ); + config.setAutoResolveSnapshots( autoResolveSnapshots ); if ( checkModificationExcludeList != null ) { @@ -317,6 +358,7 @@ protected void prepareRelease( boolean generateReleasePoms ) prepareRequest.setReleaseDescriptorBuilder( config ); prepareRequest.setReleaseEnvironment( getReleaseEnvironment() ); prepareRequest.setReactorProjects( getReactorProjects() ); + prepareRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog(), dryRun ) ); prepareRequest.setResume( resume ); prepareRequest.setDryRun( dryRun ); prepareRequest.setUserProperties( session.getUserProperties() ); diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java index 970dad6fc..11778c6f9 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/RollbackReleaseMojo.java @@ -22,15 +22,18 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; import org.apache.maven.shared.release.ReleaseExecutionException; import org.apache.maven.shared.release.ReleaseFailureException; import org.apache.maven.shared.release.ReleaseRollbackRequest; +import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder; /** * Rollback changes made by a previous release. This requires that the previous release descriptor * release.properties is still available in the local working copy. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/rollback-release.html. + * href="https://maven.apache.org/plugins/maven-release-plugin/examples/rollback-release.html" + * >https://maven.apache.org/plugins/maven-release-plugin/examples/rollback-release.html. * * @since 2.0-beta-5 * @author Edwin Punzalan @@ -40,18 +43,44 @@ public class RollbackReleaseMojo extends AbstractScmReleaseMojo { + + /** + * The SCM commit comment when rolling back. + * Defaults to "@{prefix} rollback the release of @{releaseLabel}". + *

    + * Property interpolation is performed on the value, but in order to ensure that the interpolation occurs + * during release, you must use @{...} to reference the properties rather than ${...}. + * The following properties are available: + *

      + *
    • prefix - The comment prefix. + *
    • groupId - The groupId of the root project. + *
    • artifactId - The artifactId of the root project. + *
    • releaseLabel - The release version of the root project. + *
    + * + * @since 3.0.0 + */ + @Parameter( + defaultValue = "@{prefix} rollback the release of @{releaseLabel}", + property = "scmRollbackCommitComment" ) + private String scmRollbackCommitComment = "@{prefix} rollback the release of @{releaseLabel}"; + @Override public void execute() throws MojoExecutionException, MojoFailureException { super.execute(); + final ReleaseDescriptorBuilder config = createReleaseDescriptor(); + config.setScmRollbackCommitComment( scmRollbackCommitComment ); + try { ReleaseRollbackRequest rollbackRequest = new ReleaseRollbackRequest(); - rollbackRequest.setReleaseDescriptorBuilder( createReleaseDescriptor() ); + rollbackRequest.setReleaseDescriptorBuilder( config ); rollbackRequest.setReleaseEnvironment( getReleaseEnvironment() ); rollbackRequest.setReactorProjects( getReactorProjects() ); + rollbackRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog() ) ); releaseManager.rollback( rollbackRequest ); } diff --git a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java index 2aa1e8e98..17c47de8a 100644 --- a/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java +++ b/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/UpdateVersionsMojo.java @@ -24,6 +24,7 @@ import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.shared.release.DefaultReleaseManagerListener; import org.apache.maven.shared.release.ReleaseExecutionException; import org.apache.maven.shared.release.ReleaseFailureException; import org.apache.maven.shared.release.ReleaseUpdateVersionsRequest; @@ -32,8 +33,8 @@ /** * Update the POM versions for a project. This performs the normal version updates of the release:prepare goal * without making other modifications to the SCM such as tagging. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/update-versions.html. + * href="https://maven.apache.org/plugins/maven-release-plugin/examples/update-versions.html" + * >https://maven.apache.org/plugins/maven-release-plugin/examples/update-versions.html. * * @author Paul Gier * @version $Id$ @@ -114,6 +115,7 @@ public void execute() updateVersionsRequest.setReleaseDescriptorBuilder( config ); updateVersionsRequest.setReleaseEnvironment( getReleaseEnvironment() ); updateVersionsRequest.setReactorProjects( getReactorProjects() ); + updateVersionsRequest.setReleaseManagerListener( new DefaultReleaseManagerListener( getLog() ) ); updateVersionsRequest.setUserProperties( session.getUserProperties() ); releaseManager.updateVersions( updateVersionsRequest ); diff --git a/maven-release-policies/maven-release-oddeven-policy/src/site/site.xml b/maven-release-policies/maven-release-oddeven-policy/src/site/site.xml new file mode 100644 index 000000000..220ecbb57 --- /dev/null +++ b/maven-release-policies/maven-release-oddeven-policy/src/site/site.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/maven-release-policies/maven-release-semver-policy/pom.xml b/maven-release-policies/maven-release-semver-policy/pom.xml index e5aa95121..0f003d2e1 100644 --- a/maven-release-policies/maven-release-semver-policy/pom.xml +++ b/maven-release-policies/maven-release-semver-policy/pom.xml @@ -1,82 +1,81 @@ - - - - - 4.0.0 - - - org.apache.maven.release - maven-release - 3.0.0-SNAPSHOT - ../.. - - - maven-release-semver-policy - - Maven Release SemVer Policy - - A version policy that enforce SemVer format and upgrades minor element for next development version. - - - - - ${project.parent.groupId} - maven-release-api - ${project.parent.version} - - - org.semver - api - 0.9.33 - - - - - org.codehaus.plexus - plexus-component-annotations - true - - - - junit - junit - test - - - - - - - org.codehaus.plexus - plexus-component-metadata - - - process-classes - - generate-metadata - - - - - - - + + + + + 4.0.0 + + + org.apache.maven.release + maven-release + 3.0.0-SNAPSHOT + ../.. + + + maven-release-semver-policy + + Maven Release SemVer Policy + + A version policy that enforce SemVer format and upgrades minor element for next development version. + + + + + ${project.parent.groupId} + maven-release-api + ${project.parent.version} + + + org.semver + api + 0.9.33 + + + + + org.codehaus.plexus + plexus-component-annotations + true + + + + junit + junit + test + + + + + + + org.codehaus.plexus + plexus-component-metadata + + + process-classes + + generate-metadata + + + + + + + \ No newline at end of file diff --git a/maven-release-policies/maven-release-semver-policy/src/site/site.xml b/maven-release-policies/maven-release-semver-policy/src/site/site.xml new file mode 100644 index 000000000..220ecbb57 --- /dev/null +++ b/maven-release-policies/maven-release-semver-policy/src/site/site.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4c6255c36..4782f72f9 100644 --- a/pom.xml +++ b/pom.xml @@ -24,8 +24,8 @@ org.apache.maven maven-parent - 27 - ../pom/maven/pom.xml + 33 + org.apache.maven.release @@ -56,12 +56,12 @@ Jenkins - https://builds.apache.org/job/maven-release/ + https://builds.apache.org/job/maven-box/job/maven-release/ apache.website - scm:svn:https://svn.apache.org/repos/infra/websites/production/maven/components/${maven.site.path} + scm:svn:https://svn.apache.org/repos/asf/maven/website/components/${maven.site.path} @@ -84,10 +84,11 @@ - 1.9.6-SNAPSHOT + 1.11.2 7 3.0 maven-release-archives/maven-release-LATEST + 2019-12-08T19:56:05Z @@ -99,31 +100,26 @@ .repository - Jenkinsfile + - org.apache.maven.plugins - maven-release-plugin - - true - + maven-source-plugin + 3.2.0 - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 + maven-jar-plugin + 3.2.0 - org.codehaus.mojo - findbugs-maven-plugin - 3.0.5 + maven-assembly-plugin + 3.2.0 org.codehaus.plexus plexus-component-metadata - 1.7.1 + 2.1.0 diff --git a/src/site/apt/index.apt b/src/site/apt/index.apt index 4e3c20a6c..1f0b5da66 100644 --- a/src/site/apt/index.apt +++ b/src/site/apt/index.apt @@ -32,9 +32,15 @@ Maven Release *----------------------------------------------------------+----------------+ || Module || Description || *----------------------------------------------------------+----------------+ -| {{{./maven-release-manager/}maven-release-manager}} | core classes, +| {{{./maven-release-api/}maven-release-api}} | APIs to implement to extend maven-release-plugin *----------------------------------------------------------+----------------+ -| {{{/plugins/maven-release-plugin/}maven-release-plugin}} | release plugin to use from Maven. +| {{{./maven-release-manager/}maven-release-manager}} | core classes +*----------------------------------------------------------+----------------+ +| {{{./maven-release-plugin/}maven-release-plugin}} | release plugin to use from Maven +*----------------------------------------------------------+----------------+ +| {{{./maven-release-policies/maven-release-oddeven-policy/}maven-release-oddeven-policy}} | a version policy that proposes even version numbers only for releases and odd numbers for development +*----------------------------------------------------------+----------------+ +| {{{./maven-release-policies/maven-release-semver-policy/}maven-release-semver-policy}} | a version policy that enforce SemVer format and upgrades minor element for next development version *----------------------------------------------------------+----------------+ Notes for Developers diff --git a/src/site/site.xml b/src/site/site.xml index 635f2a857..027bb6ae4 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -22,13 +22,7 @@ under the License. - - - org.apache.maven.skins - maven-fluido-skin - 1.3.1 - - + diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index 12a3d979f..b86131de8 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -34,7 +34,7 @@ under the License.

    In order to guard against corrupted downloads/installations, it is highly recommended to verify the signature - of the release bundles against the public KEYS used by the Apache Maven + of the release bundles against the public KEYS used by the Apache Maven developers.

    ${project.name} is distributed under the Apache License, version 2.0.

    @@ -108,8 +108,8 @@ under the License. ${project.name} ${project.version} (Source zip) maven/release/${project.artifactId}-${project.version}-source-release.zip - maven/release/${project.artifactId}-${project.version}-source-release.zip.sha1 - maven/release/${project.artifactId}-${project.version}-source-release.zip.asc + maven/release/${project.artifactId}-${project.version}-source-release.zip.sha512 + maven/release/${project.artifactId}-${project.version}-source-release.zip.asc