maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r997380 - in /maven/maven-3/trunk: ./ maven-aether-provider/src/main/java/org/apache/maven/repository/internal/ maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ maven-artifact/src/test/java/org/apache/maven/artifact/versio...
Date Wed, 15 Sep 2010 16:08:51 GMT
Author: bentmann
Date: Wed Sep 15 16:08:51 2010
New Revision: 997380

URL: http://svn.apache.org/viewvc?rev=997380&view=rev
Log:
[MNG-4751] Snapshot version not resolved for version range

o Reverted fix for MNG-3092 until we have a more robust solution in place

Modified:
    maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
    maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java
    maven/maven-3/trunk/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java
    maven/maven-3/trunk/pom.xml

Modified: maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java?rev=997380&r1=997379&r2=997380&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
(original)
+++ maven/maven-3/trunk/maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
Wed Sep 15 16:08:51 2010
@@ -23,7 +23,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -42,7 +41,6 @@ import org.sonatype.aether.util.version.
 import org.sonatype.aether.version.InvalidVersionSpecificationException;
 import org.sonatype.aether.version.Version;
 import org.sonatype.aether.version.VersionConstraint;
-import org.sonatype.aether.version.VersionRange;
 import org.sonatype.aether.version.VersionScheme;
 import org.sonatype.aether.impl.MetadataResolver;
 import org.sonatype.aether.impl.VersionRangeResolver;
@@ -125,8 +123,7 @@ public class DefaultVersionRangeResolver
         }
         else
         {
-            Map<String, ArtifactRepository> versionIndex =
-                getVersions( session, result, request, getNature( session, versionConstraint.getRanges()
) );
+            Map<String, ArtifactRepository> versionIndex = getVersions( session, result,
request );
 
             List<Version> versions = new ArrayList<Version>();
             for ( Map.Entry<String, ArtifactRepository> v : versionIndex.entrySet()
)
@@ -154,13 +151,13 @@ public class DefaultVersionRangeResolver
     }
 
     private Map<String, ArtifactRepository> getVersions( RepositorySystemSession session,
VersionRangeResult result,
-                                                         VersionRangeRequest request, Metadata.Nature
nature )
+                                                         VersionRangeRequest request )
     {
         Map<String, ArtifactRepository> versionIndex = new HashMap<String, ArtifactRepository>();
 
         Metadata metadata =
             new DefaultMetadata( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(),
-                                 MAVEN_METADATA_XML, nature );
+                                 MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT
);
 
         List<MetadataRequest> metadataRequests = new ArrayList<MetadataRequest>(
request.getRepositories().size() );
         for ( RemoteRepository repository : request.getRepositories() )
@@ -212,18 +209,6 @@ public class DefaultVersionRangeResolver
         return versionIndex;
     }
 
-    private Metadata.Nature getNature( RepositorySystemSession session, Collection<VersionRange>
ranges )
-    {
-        for ( VersionRange range : ranges )
-        {
-            if ( range.acceptsSnapshots() )
-            {
-                return Metadata.Nature.RELEASE_OR_SNAPSHOT;
-            }
-        }
-        return Metadata.Nature.RELEASE;
-    }
-
     private Versioning readVersions( RepositorySystemSession session, Metadata metadata,
VersionRangeResult result )
     {
         Versioning versioning = null;

Modified: maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java?rev=997380&r1=997379&r2=997380&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java
(original)
+++ maven/maven-3/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/Restriction.java
Wed Sep 15 16:08:51 2010
@@ -19,8 +19,6 @@ package org.apache.maven.artifact.versio
  * under the License.
  */
 
-import org.apache.maven.artifact.Artifact;
-
 /**
  * Describes a restriction in versioning.
  *
@@ -70,17 +68,10 @@ public class Restriction
 
     public boolean containsVersion( ArtifactVersion version )
     {
-        boolean snapshot = isSnapshot( version );
-
         if ( lowerBound != null )
         {
             int comparison = lowerBound.compareTo( version );
 
-            if ( snapshot && comparison == 0 )
-            {
-                return true;
-            }
-
             if ( ( comparison == 0 ) && !lowerBoundInclusive )
             {
                 return false;
@@ -94,11 +85,6 @@ public class Restriction
         {
             int comparison = upperBound.compareTo( version );
 
-            if ( snapshot && comparison == 0 )
-            {
-                return true;
-            }
-
             if ( ( comparison == 0 ) && !upperBoundInclusive )
             {
                 return false;
@@ -109,19 +95,9 @@ public class Restriction
             }
         }
 
-        if ( lowerBound != null || upperBound != null )
-        {
-            return !snapshot;
-        }
-
         return true;
     }
 
-    private boolean isSnapshot( ArtifactVersion version )
-    {
-        return Artifact.SNAPSHOT_VERSION.equals( version.getQualifier() );
-    }
-
     @Override
     public int hashCode()
     {

Modified: maven/maven-3/trunk/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java?rev=997380&r1=997379&r2=997380&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java
(original)
+++ maven/maven-3/trunk/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java
Wed Sep 15 16:08:51 2010
@@ -655,13 +655,13 @@ public class VersionRangeTest
         assertEquals( CHECK_NUM_RESTRICTIONS, 0, restrictions.size() );
     }
 
-    public void testReleaseRangeBoundsCannotContainSnapshots()
+    public void testReleaseRangeBoundsContainsSnapshots()
         throws InvalidVersionSpecificationException
     {
         VersionRange range = VersionRange.createFromVersionSpec( "[1.0,1.2]" );
 
-        assertFalse( range.containsVersion( new DefaultArtifactVersion( "1.1-SNAPSHOT" )
) );
-        assertFalse( range.containsVersion( new DefaultArtifactVersion( "1.2-SNAPSHOT" )
) );
+        assertTrue( range.containsVersion( new DefaultArtifactVersion( "1.1-SNAPSHOT" ) )
);
+        assertTrue( range.containsVersion( new DefaultArtifactVersion( "1.2-SNAPSHOT" ) )
);
     }
 
     public void testSnapshotRangeBoundsCanContainSnapshots()
@@ -669,13 +669,13 @@ public class VersionRangeTest
     {
         VersionRange range = VersionRange.createFromVersionSpec( "[1.0,1.2-SNAPSHOT]" );
 
-        assertFalse( range.containsVersion( new DefaultArtifactVersion( "1.1-SNAPSHOT" )
) );
+        assertTrue( range.containsVersion( new DefaultArtifactVersion( "1.1-SNAPSHOT" ) )
);
         assertTrue( range.containsVersion( new DefaultArtifactVersion( "1.2-SNAPSHOT" ) )
);
 
         range = VersionRange.createFromVersionSpec( "[1.0-SNAPSHOT,1.2]" );
 
         assertTrue( range.containsVersion( new DefaultArtifactVersion( "1.0-SNAPSHOT" ) )
);
-        assertFalse( range.containsVersion( new DefaultArtifactVersion( "1.1-SNAPSHOT" )
) );
+        assertTrue( range.containsVersion( new DefaultArtifactVersion( "1.1-SNAPSHOT" ) )
);
     }
 
     public void testSnapshotSoftVersionCanContainSnapshot()

Modified: maven/maven-3/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/pom.xml?rev=997380&r1=997379&r2=997380&view=diff
==============================================================================
--- maven/maven-3/trunk/pom.xml (original)
+++ maven/maven-3/trunk/pom.xml Wed Sep 15 16:08:51 2010
@@ -50,7 +50,7 @@
     <cipherVersion>1.4</cipherVersion>
     <modelloVersion>1.4</modelloVersion>
     <jxpathVersion>1.3</jxpathVersion>
-    <aetherVersion>1.3</aetherVersion>
+    <aetherVersion>1.4</aetherVersion>
     <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
   </properties>
 



Mime
View raw message