mirror of https://github.com/apache/maven.git
[MNG-4522] Maven3 doesn't fail build when a pom from transitive dependency can't be found
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@902573 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
974bf9d27a
commit
3b35b6222a
|
@ -569,7 +569,10 @@ public class DefaultArtifactResolver
|
|||
}
|
||||
catch ( ArtifactMetadataRetrievalException e )
|
||||
{
|
||||
// need to add metadata resolution exception
|
||||
ArtifactResolutionException are =
|
||||
new ArtifactResolutionException( "Unable to get dependency information for " + rootArtifact.getId()
|
||||
+ ": " + e.getMessage(), rootArtifact, metadataRequest.getRemoteRepositories(), e );
|
||||
result.addMetadataResolutionException( are );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -583,8 +583,8 @@ public class DefaultLegacyArtifactCollector
|
|||
{
|
||||
artifact.setDependencyTrail( node.getDependencyTrail() );
|
||||
|
||||
throw new ArtifactResolutionException( "Unable to get dependency information: "
|
||||
+ e.getMessage(), artifact, childRemoteRepositories, e );
|
||||
throw new ArtifactResolutionException( "Unable to get dependency information for "
|
||||
+ artifact.getId() + ": " + e.getMessage(), artifact, childRemoteRepositories, e );
|
||||
}
|
||||
|
||||
ArtifactResolutionRequest subRequest = new ArtifactResolutionRequest( metadataRequest );
|
||||
|
|
|
@ -54,7 +54,10 @@ import org.apache.maven.model.DependencyManagement;
|
|||
import org.apache.maven.model.DistributionManagement;
|
||||
import org.apache.maven.model.Exclusion;
|
||||
import org.apache.maven.model.Relocation;
|
||||
import org.apache.maven.model.building.ModelBuildingException;
|
||||
import org.apache.maven.model.building.ModelBuildingRequest;
|
||||
import org.apache.maven.model.building.ModelProblem;
|
||||
import org.apache.maven.model.resolution.UnresolvableModelException;
|
||||
import org.apache.maven.plugin.LegacySupport;
|
||||
import org.apache.maven.project.DefaultProjectBuildingRequest;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
@ -573,17 +576,26 @@ public class MavenMetadataSource
|
|||
}
|
||||
catch ( ProjectBuildingException e )
|
||||
{
|
||||
ModelProblem missingParentPom = hasMissingParentPom( e );
|
||||
if ( missingParentPom != null )
|
||||
{
|
||||
throw new ArtifactMetadataRetrievalException( "Failed to process POM for "
|
||||
+ relocatedArtifact.getId() + ": " + missingParentPom.getMessage(),
|
||||
missingParentPom.getException(),
|
||||
relocatedArtifact );
|
||||
}
|
||||
|
||||
String message;
|
||||
|
||||
// missing/incompatible POM (e.g. a Maven 1 POM)
|
||||
if ( e.getCause() instanceof ArtifactResolutionException )
|
||||
if ( isMissingPom( e ) )
|
||||
{
|
||||
message = "Missing artifact metadata for " + relocatedArtifact.getId();
|
||||
message = "Missing POM for " + relocatedArtifact.getId();
|
||||
}
|
||||
else
|
||||
{
|
||||
message =
|
||||
"Invalid artifact metadata for " + relocatedArtifact.getId()
|
||||
"Invalid POM for " + relocatedArtifact.getId()
|
||||
+ ", transitive dependencies (if any) will not be available"
|
||||
+ ", enable debug logging for more details";
|
||||
}
|
||||
|
@ -693,6 +705,28 @@ public class MavenMetadataSource
|
|||
return rel;
|
||||
}
|
||||
|
||||
private boolean isMissingPom( ProjectBuildingException e )
|
||||
{
|
||||
return e.getCause() instanceof ArtifactResolutionException;
|
||||
}
|
||||
|
||||
private ModelProblem hasMissingParentPom( ProjectBuildingException e )
|
||||
{
|
||||
if ( e.getCause() instanceof ModelBuildingException )
|
||||
{
|
||||
ModelBuildingException mbe = (ModelBuildingException) e.getCause();
|
||||
for ( ModelProblem problem : mbe.getProblems() )
|
||||
{
|
||||
if ( problem.getException() instanceof UnresolvableModelException )
|
||||
{
|
||||
return problem;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Properties getSystemProperties()
|
||||
{
|
||||
Properties props = new Properties();
|
||||
|
|
Loading…
Reference in New Issue