maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r332220 - /maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
Date Thu, 10 Nov 2005 04:26:24 GMT
Author: jdcasey
Date: Wed Nov  9 20:26:14 2005
New Revision: 332220

URL: http://svn.apache.org/viewcvs?rev=332220&view=rev
Log:
PR: MNG-1363

o Disabled version-range checking for system-scoped dependencies...will use recommendedVersion
where available, if a concrete version is not available.

o Disabled collection of the transitive deps of a system-scoped dep.


Modified:
    maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java

Modified: maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java?rev=332220&r1=332219&r2=332220&view=diff
==============================================================================
--- maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
(original)
+++ maven/components/trunk/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
Wed Nov  9 20:26:14 2005
@@ -231,46 +231,67 @@
                     {
                         if ( artifact.getVersion() == null )
                         {
-                            // set the recommended version
-                            // TODO: maybe its better to just pass the range through to retrieval
and use a transformation?
-                            ArtifactVersion version;
-                            if ( !artifact.isSelectedVersionKnown() )
+                            if ( Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
                             {
-                                List versions = artifact.getAvailableVersions();
-                                if ( versions == null )
-                                {
-                                    versions = source.retrieveAvailableVersions( artifact,
localRepository,
-                                                                                 remoteRepositories
);
-                                    artifact.setAvailableVersions( versions );
-                                }
-
+                                String selectedVersion = "unknown";
                                 VersionRange versionRange = artifact.getVersionRange();
-
-                                version = versionRange.matchVersion( versions );
-
-                                if ( version == null )
+                                
+                                if ( versionRange != null )
                                 {
-                                    if ( versions.isEmpty() )
+                                    ArtifactVersion version = ( versionRange != null ) ?
( versionRange.getRecommendedVersion() ) : null;
+                                    
+                                    if ( version != null )
                                     {
-                                        throw new OverConstrainedVersionException(
-                                            "No versions are present in the repository for
the artifact with a range " +
-                                                versionRange, artifact, remoteRepositories
);
-                                    }
-                                    else
-                                    {
-                                        throw new OverConstrainedVersionException( "Couldn't
find a version in " +
-                                            versions + " to match range " + versionRange,
artifact,
-                                                                                        
 remoteRepositories );
+                                        selectedVersion = version.toString();
                                     }
                                 }
+                                
+                                artifact.selectVersion( selectedVersion );
                             }
                             else
                             {
-                                version = artifact.getSelectedVersion();
-                            }
+                                // set the recommended version
+                                // TODO: maybe its better to just pass the range through
to retrieval and use a transformation?
+                                ArtifactVersion version;
+                                if ( !artifact.isSelectedVersionKnown() )
+                                {
+                                    List versions = artifact.getAvailableVersions();
+                                    if ( versions == null )
+                                    {
+                                        versions = source.retrieveAvailableVersions( artifact,
localRepository,
+                                                                                     remoteRepositories
);
+                                        artifact.setAvailableVersions( versions );
+                                    }
 
-                            artifact.selectVersion( version.toString() );
-                            fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners,
child );
+                                    VersionRange versionRange = artifact.getVersionRange();
+
+                                    version = versionRange.matchVersion( versions );
+
+                                    if ( version == null )
+                                    {
+                                        if ( versions.isEmpty() )
+                                        {
+                                            throw new OverConstrainedVersionException(
+                                                                                       "No
versions are present in the repository for the artifact with a range "
+                                                                                        
  + versionRange, artifact,
+                                                                                       remoteRepositories
);
+                                        }
+                                        else
+                                        {
+                                            throw new OverConstrainedVersionException( "Couldn't
find a version in "
+                                                + versions + " to match range " + versionRange,
artifact,
+                                                                                       remoteRepositories
);
+                                        }
+                                    }
+                                }
+                                else
+                                {
+                                    version = artifact.getSelectedVersion();
+                                }
+
+                                artifact.selectVersion( version.toString() );
+                                fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE,
listeners, child );
+                            }
                         }
 
                         ResolutionGroup rGroup = source.retrieve( artifact, localRepository,
remoteRepositories );
@@ -300,8 +321,12 @@
                             e );
                     }
 
-                    recurse( child, resolvedArtifacts, managedVersions, localRepository,
remoteRepositories, source,
-                             filter, listeners );
+                    // don't pull in the transitive deps of a system-scoped dependency.
+                    if ( !Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) )
+                    {
+                        recurse( child, resolvedArtifacts, managedVersions, localRepository,
remoteRepositories,
+                                 source, filter, listeners );
+                    }
                 }
             }
 



Mime
View raw message