}
result.addException( exception );
throw new ArtifactDescriptorException( result );
}
Artifact pomArtifact = ArtifactDescriptorUtils.toPomArtifact( artifact );
ArtifactResult resolveResult;
try
{
ArtifactRequest resolveRequest =
new ArtifactRequest( pomArtifact, request.getRepositories(), request.getRequestContext() );
resolveRequest.setTrace( trace );
resolveResult = artifactResolver.resolveArtifact( session, resolveRequest );
pomArtifact = resolveResult.getArtifact();
result.setRepository( resolveResult.getRepository() );
}
catch ( ArtifactResolutionException e )
{
if ( e.getCause() instanceof ArtifactNotFoundException )
{
missingDescriptor( session, trace, artifact, (Exception) e.getCause() );
if ( ( getPolicy( session, artifact, request ) & ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
{
return null;
}
}
result.addException( e );
throw new ArtifactDescriptorException( result );
}
Model model;
try
{
ModelBuildingRequest modelRequest = new DefaultModelBuildingRequest();
modelRequest.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL );
modelRequest.setProcessPlugins( false );
modelRequest.setTwoPhaseBuilding( false );
modelRequest.setSystemProperties( toProperties( session.getUserProperties(),
session.getSystemProperties() ) );
modelRequest.setModelCache( DefaultModelCache.newInstance( session ) );
modelRequest.setModelResolver( new DefaultModelResolver( session, trace.newChild( modelRequest ),
request.getRequestContext(), artifactResolver,
remoteRepositoryManager,
request.getRepositories() ) );
if ( resolveResult.getRepository() instanceof WorkspaceRepository )
{
modelRequest.setPomFile( pomArtifact.getFile() );
}
else
{
modelRequest.setModelSource( new FileModelSource( pomArtifact.getFile() ) );
}
model = modelBuilder.build( modelRequest ).getEffectiveModel();
}
catch ( ModelBuildingException e )