From 3997bdfcfe9f34f1f5191b81a38e618bcf84270a Mon Sep 17 00:00:00 2001 From: ltheussl Date: Thu, 1 Dec 2005 01:04:13 +0000 Subject: [PATCH] PR: MPARTIFACT-56 When deploying a snapshot, jar and pom have different timestamped version git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@350091 13f79535-47bb-0310-9956-ffa450edef68 --- .../deployer/DefaultArtifactDeployer.java | 19 ++++++++++++++----- artifact/xdocs/changes.xml | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java b/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java index d2afc97c..3ceb57fc 100644 --- a/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java +++ b/artifact/src/main/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java @@ -77,6 +77,8 @@ public class DefaultArtifactDeployer */ private final static String SNAPSHOT_FORMAT = "yyyyMMdd.HHmmss"; + private String snapshotSignature; + private static final Log LOG = LogFactory.getLog( DefaultArtifactDeployer.class ); /** @@ -118,6 +120,9 @@ public class DefaultArtifactDeployer } doDeploy( file, project, handler, version, type ); + + snapshotSignature = null; + } /** @@ -245,8 +250,8 @@ public class DefaultArtifactDeployer if ( version.indexOf( MavenConstants.SNAPSHOT_SIGNIFIER ) >= 0 ) { - String snapshotSignature = getSnapshotSignature(); - String v = StringUtils.replace( version, MavenConstants.SNAPSHOT_SIGNIFIER, snapshotSignature ); + String signature = getSnapshotSignature(); + String v = StringUtils.replace( version, MavenConstants.SNAPSHOT_SIGNIFIER, signature ); File snapshotVersionFile = createSnapshotVersionFile( file, v, project, type ); @@ -455,9 +460,13 @@ public class DefaultArtifactDeployer private String getSnapshotSignature() { - DateFormat fmt = new SimpleDateFormat( SNAPSHOT_FORMAT ); - fmt.setTimeZone( TimeZone.getTimeZone( "GMT" ) ); - return fmt.format( new Date() ); + if ( snapshotSignature == null ) + { + DateFormat fmt = new SimpleDateFormat( SNAPSHOT_FORMAT ); + fmt.setTimeZone( TimeZone.getTimeZone( "GMT" ) ); + snapshotSignature = fmt.format( new Date() ); + } + return snapshotSignature; } private File getFileForArtifact( String artifact ) diff --git a/artifact/xdocs/changes.xml b/artifact/xdocs/changes.xml index e812bdba..d11a1645 100644 --- a/artifact/xdocs/changes.xml +++ b/artifact/xdocs/changes.xml @@ -25,6 +25,7 @@ + When deploying a snapshot, jar and pom have different timestamped version. Make deploying a timestamped SNAPSHOT artifact configurable. Update dependencies to match ones in maven 1.1 core and to unify them between plugins. The following dependencies are updated :