[MNG-2083] Correcting problem where cached projects result in missing downloadUrl for unresolvable artifacts.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@379516 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2006-02-21 16:33:52 +00:00
parent 8ed5bfa817
commit b07d835b9c
3 changed files with 31 additions and 20 deletions

View File

@ -194,7 +194,7 @@ public class AbstractArtifactResolutionException
sb.append( LS );
sb.append( LS );
sb.append( indentation );
sb.append( "Try downloading the file manually from" );
sb.append( "Try downloading the file manually from: " );
sb.append( LS );
sb.append( indentation );
sb.append( " " );

View File

@ -16,7 +16,23 @@ public class MultipleArtifactsNotFoundException
private static String constructMessage( List artifacts )
{
StringBuffer buffer = new StringBuffer();
StringBuffer buffer = new StringBuffer( "Missing:\n" );
buffer.append( "----------\n" );
int counter = 0;
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
{
Artifact artifact = (Artifact) i.next();
String message = ( ++counter ) + ") " + artifact.getId();
buffer.append( constructMissingArtifactMessage( message, " ", artifact.getGroupId(), artifact
.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getDownloadUrl(), artifact
.getDependencyTrail() ) );
}
buffer.append( "----------\n" );
int size = artifacts.size();
@ -24,26 +40,14 @@ public class MultipleArtifactsNotFoundException
if ( size > 1 )
{
buffer.append( "s" );
buffer.append( "s are" );
}
buffer.append( " missing:\n" );
int counter = 0;
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
else
{
Artifact artifact = (Artifact) i.next();
String message = "\n" + ( ++counter ) + ") " + artifact.getId();
buffer.append( constructMissingArtifactMessage( message, " ", artifact.getGroupId(), artifact
.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getDownloadUrl(), artifact
.getDependencyTrail() ) );
buffer.append( "\n" );
buffer.append( " is" );
}
buffer.append( "\nfor the artifact:" );
buffer.append( " missing.\n\nfor artifact: " );
return buffer.toString();
}

View File

@ -140,6 +140,9 @@ public class MavenMetadataSource
if ( distMgmt != null )
{
relocation = distMgmt.getRelocation();
artifact.setDownloadUrl( distMgmt.getDownloadUrl() );
pomArtifact.setDownloadUrl( distMgmt.getDownloadUrl() );
}
if ( relocation != null )
@ -195,8 +198,12 @@ public class MavenMetadataSource
}
while ( !done );
// last ditch effort to try to get this set...
if ( artifact.getDownloadUrl() == null )
{
// TODO: this could come straight from the project, negating the need to set it in the project itself?
artifact.setDownloadUrl( pomArtifact.getDownloadUrl() );
}
ResolutionGroup result;