brett       2005/04/05 07:17:55

  Modified:    maven-artifact/src/main/java/org/apache/maven/artifact/metadata
                        SnapshotArtifactMetadata.java
  Log:
  quick way to share a snapshot version per JVM instance
  
  Revision  Changes    Path
  1.16      +15 -3     
maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/SnapshotArtifactMetadata.java
  
  Index: SnapshotArtifactMetadata.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/SnapshotArtifactMetadata.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SnapshotArtifactMetadata.java     5 Apr 2005 07:01:06 -0000       1.15
  +++ SnapshotArtifactMetadata.java     5 Apr 2005 14:17:55 -0000       1.16
  @@ -58,6 +58,9 @@
   
       private static final Pattern VERSION_FILE_PATTERN = Pattern.compile( 
"^(.*)-([0-9]{8}.[0-9]{6})-([0-9]+)$" );
   
  +    // TODO: very quick and nasty hack to get the same timestamp across a 
build - not embedder friendly
  +    private static String sessionTimestamp = null;
  +
       public SnapshotArtifactMetadata( Artifact artifact )
       {
           super( artifact, artifact.getArtifactId() + "-" + 
artifact.getBaseVersion() + "." + SNAPSHOT_VERSION_FILE );
  @@ -83,7 +86,7 @@
           {
               if ( timestamp == null )
               {
  -                timestamp = getUtcDateFormatter().format( new Date() );
  +                timestamp = getSessionTimestamp();
               }
               String path = getLocalRepositoryLocation( localRepository 
).getPath();
               File file = new File( path );
  @@ -201,7 +204,16 @@
       public void update()
       {
           this.buildNumber++;
  -        timestamp = getUtcDateFormatter().format( new Date() );
  +        timestamp = getSessionTimestamp();
  +    }
  +
  +    private static String getSessionTimestamp()
  +    {
  +        if ( sessionTimestamp == null )
  +        {
  +            sessionTimestamp = getUtcDateFormatter().format( new Date() );
  +        }
  +        return sessionTimestamp;
       }
   
   
  
  
  

Reply via email to