You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2008/03/06 01:35:25 UTC
svn commit: r634093 -
/maven/components/branches/maven-2.0.x/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
Author: brianf
Date: Wed Mar 5 16:35:23 2008
New Revision: 634093
URL: http://svn.apache.org/viewvc?rev=634093&view=rev
Log:
MNG-2123: fixed the range resolution code. It was incorrectly expecting that the previous nodes had resolved the available versions and they weren't.
Modified:
maven/components/branches/maven-2.0.x/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
Modified: maven/components/branches/maven-2.0.x/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java?rev=634093&r1=634092&r2=634093&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java (original)
+++ maven/components/branches/maven-2.0.x/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java Wed Mar 5 16:35:23 2008
@@ -192,10 +192,33 @@
for ( int j = 0; j < 2; j++ )
{
Artifact resetArtifact = resetNodes[j].getArtifact();
- if ( resetArtifact.getVersion() == null && resetArtifact.getVersionRange() != null &&
- resetArtifact.getAvailableVersions() != null )
+
+ //MNG-2123: if the previous node was not a range, then it wouldn't have any available
+ //versions. We just clobbered the selected version above. (why? i have no idea.)
+ //So since we are here and this is ranges we must go figure out the version (for a third time...)
+ if ( resetArtifact.getVersion() == null && resetArtifact.getVersionRange() != null)
{
+ //go find the version. This is a total hack. See previous comment.
+ List versions = resetArtifact.getAvailableVersions();
+ if ( versions == null )
+ {
+ try
+ {
+ versions =
+ source.retrieveAvailableVersions( resetArtifact, localRepository,
+ remoteRepositories );
+ resetArtifact.setAvailableVersions( versions );
+ }
+ catch ( ArtifactMetadataRetrievalException e )
+ {
+ resetArtifact.setDependencyTrail( node.getDependencyTrail() );
+ throw new ArtifactResolutionException(
+ "Unable to get dependency information: " +
+ e.getMessage(), resetArtifact,
+ remoteRepositories, e );
+ }
+ }
resetArtifact.selectVersion( resetArtifact.getVersionRange().matchVersion(
resetArtifact.getAvailableVersions() ).toString() );
fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, resetNodes[j] );