buildProject( new RepositoryModelResolver( basedir, pathTranslator ), artifact.getGroupId(),
artifact.getArtifactId(), artifact.getVersion() );
}
catch ( ModelBuildingException e )
{
throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
}
catch ( UnresolvableModelException e )
{
throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
}
}
ResolutionGroup result;
if ( project == null )
{
// TODO: we could record this so that it is displayed in the dependency tree as (...) or similar
// if the project is null, we encountered an invalid model (read: m1 POM)
// we'll just return an empty resolution group.
// or used the inherited scope (should that be passed to the buildFromRepository method above?)
result = new ResolutionGroup( pomArtifact, Collections.<Artifact>emptySet(), Collections.<ArtifactRepository>emptyList() );
}
else
{
Set<Artifact> artifacts = Collections.emptySet();
if ( !artifact.getArtifactHandler().isIncludesDependencies() )
{
try
{
artifacts = createArtifacts( project, artifact.getDependencyFilter() );
}
catch ( InvalidVersionSpecificationException e )
{
throw new ArtifactMetadataRetrievalException( e.getMessage(), e, artifact );
}
}
result = new ResolutionGroup( pomArtifact, artifacts, Collections.<ArtifactRepository>emptyList() );
}