maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r995081 - in /maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal: LocalSnapshotMetadata.java RemoteSnapshotMetadata.java RemoteSnapshotMetadataGenerator.java VersionsMetadata.java
Date Wed, 08 Sep 2010 15:04:45 GMT
Author: bentmann
Date: Wed Sep  8 15:04:45 2010
New Revision: 995081

URL: http://svn.apache.org/viewvc?rev=995081&view=rev
Log:
[MNG-4452] Metadata for snapshots should include classifier

o Added boolean system/execution property maven.metadata.legacy to enable 1.0.0 format to
allow for interop with existing repo mans that could choke on the new format when processing
it on the server side

Modified:
    maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
    maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
    maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
    maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java

Modified: maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java?rev=995081&r1=995080&r2=995081&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
(original)
+++ maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadata.java
Wed Sep  8 15:04:45 2010
@@ -55,7 +55,6 @@ final class LocalSnapshotMetadata
         versioning.setSnapshot( snapshot );
 
         Metadata metadata = new Metadata();
-        metadata.setModelVersion( "1.0.0" );
         metadata.setVersioning( versioning );
         metadata.setGroupId( artifact.getGroupId() );
         metadata.setArtifactId( artifact.getArtifactId() );

Modified: maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java?rev=995081&r1=995080&r2=995081&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
(original)
+++ maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadata.java
Wed Sep  8 15:04:45 2010
@@ -48,20 +48,27 @@ final class RemoteSnapshotMetadata
 
     private final Map<String, SnapshotVersion> versions = new LinkedHashMap<String,
SnapshotVersion>();
 
-    public RemoteSnapshotMetadata( Artifact artifact )
+    private final boolean legacyFormat;
+
+    public RemoteSnapshotMetadata( Artifact artifact, boolean legacyFormat )
     {
-        super( createMetadata( artifact ), null );
+        super( createMetadata( artifact, legacyFormat ), null );
+        this.legacyFormat = legacyFormat;
     }
 
-    private RemoteSnapshotMetadata( Metadata metadata, File file )
+    private RemoteSnapshotMetadata( Metadata metadata, File file, boolean legacyFormat )
     {
         super( metadata, file );
+        this.legacyFormat = legacyFormat;
     }
 
-    private static Metadata createMetadata( Artifact artifact )
+    private static Metadata createMetadata( Artifact artifact, boolean legacy )
     {
         Metadata metadata = new Metadata();
-        metadata.setModelVersion( "1.1.0" );
+        if ( !legacy )
+        {
+            metadata.setModelVersion( "1.1.0" );
+        }
         metadata.setGroupId( artifact.getGroupId() );
         metadata.setArtifactId( artifact.getArtifactId() );
         metadata.setVersion( artifact.getBaseVersion() );
@@ -76,7 +83,7 @@ final class RemoteSnapshotMetadata
 
     public MavenMetadata setFile( File file )
     {
-        return new RemoteSnapshotMetadata( metadata, file );
+        return new RemoteSnapshotMetadata( metadata, file, legacyFormat );
     }
 
     public Object getKey()
@@ -156,7 +163,10 @@ final class RemoteSnapshotMetadata
             }
         }
 
-        metadata.getVersioning().setSnapshotVersions( new ArrayList<SnapshotVersion>(
versions.values() ) );
+        if ( !legacyFormat )
+        {
+            metadata.getVersioning().setSnapshotVersions( new ArrayList<SnapshotVersion>(
versions.values() ) );
+        }
     }
 
     private String getKey( String classifier, String extension )

Modified: maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java?rev=995081&r1=995080&r2=995081&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
(original)
+++ maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
Wed Sep  8 15:04:45 2010
@@ -24,6 +24,7 @@ import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
+import org.sonatype.aether.ConfigurationProperties;
 import org.sonatype.aether.RepositorySystemSession;
 import org.sonatype.aether.artifact.Artifact;
 import org.sonatype.aether.deployment.DeployRequest;
@@ -37,10 +38,14 @@ class RemoteSnapshotMetadataGenerator
     implements MetadataGenerator
 {
 
-    private Map<Object, RemoteSnapshotMetadata> snapshots;
+    private final Map<Object, RemoteSnapshotMetadata> snapshots;
+
+    private final boolean legacyFormat;
 
     public RemoteSnapshotMetadataGenerator( RepositorySystemSession session, DeployRequest
request )
     {
+        legacyFormat = ConfigurationProperties.get( session.getConfigProperties(), "maven.metadata.legacy",
false );
+
         snapshots = new LinkedHashMap<Object, RemoteSnapshotMetadata>();
 
         /*
@@ -69,7 +74,7 @@ class RemoteSnapshotMetadataGenerator
                 RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key );
                 if ( snapshotMetadata == null )
                 {
-                    snapshotMetadata = new RemoteSnapshotMetadata( artifact );
+                    snapshotMetadata = new RemoteSnapshotMetadata( artifact, legacyFormat
);
                     snapshots.put( key, snapshotMetadata );
                 }
                 snapshotMetadata.bind( artifact );

Modified: maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java?rev=995081&r1=995080&r2=995081&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
(original)
+++ maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/VersionsMetadata.java
Wed Sep  8 15:04:45 2010
@@ -56,7 +56,6 @@ final class VersionsMetadata
         }
 
         Metadata metadata = new Metadata();
-        metadata.setModelVersion( "1.0.0" );
         metadata.setVersioning( versioning );
         metadata.setGroupId( artifact.getGroupId() );
         metadata.setArtifactId( artifact.getArtifactId() );



Mime
View raw message