[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,34 +16,38 @@ public class MultipleArtifactsNotFoundException
private static String constructMessage( List artifacts )
{
StringBuffer buffer = new StringBuffer();
int size = artifacts.size();
buffer.append( size ).append( " required artifact" );
if ( size > 1 )
{
buffer.append( "s" );
}
buffer.append( " missing:\n" );
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 = "\n" + ( ++counter ) + ") " + artifact.getId();
String message = ( ++counter ) + ") " + artifact.getId();
buffer.append( constructMissingArtifactMessage( message, " ", artifact.getGroupId(), artifact
.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getDownloadUrl(), artifact
.getDependencyTrail() ) );
buffer.append( "\n" );
}
buffer.append( "\nfor the artifact:" );
buffer.append( "----------\n" );
int size = artifacts.size();
buffer.append( size ).append( " required artifact" );
if ( size > 1 )
{
buffer.append( "s are" );
}
else
{
buffer.append( " is" );
}
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,9 +198,13 @@ public class MavenMetadataSource
}
while ( !done );
// TODO: this could come straight from the project, negating the need to set it in the project itself?
artifact.setDownloadUrl( pomArtifact.getDownloadUrl() );
// 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;
if ( project == null )