try
{
DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession( session );
pluginSession.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, false ) );
ArtifactDescriptorRequest request =
new ArtifactDescriptorRequest( pluginArtifact, repositories, REPOSITORY_CONTEXT );
request.setTrace( trace );
ArtifactDescriptorResult result = repoSystem.readArtifactDescriptor( pluginSession, request );
pluginArtifact = result.getArtifact();
String requiredMavenVersion = (String) result.getProperties().get( "prerequisites.maven" );
if ( requiredMavenVersion != null )
{
Map<String, String> props = new LinkedHashMap<String, String>( pluginArtifact.getProperties() );
props.put( "requiredMavenVersion", requiredMavenVersion );
pluginArtifact = pluginArtifact.setProperties( props );
}
}
catch ( ArtifactDescriptorException e )
{
throw new PluginResolutionException( plugin, e );
}
try
{
ArtifactRequest request = new ArtifactRequest( pluginArtifact, repositories, REPOSITORY_CONTEXT );
request.setTrace( trace );
pluginArtifact = repoSystem.resolveArtifact( session, request ).getArtifact();
}
catch ( ArtifactResolutionException e )
{
throw new PluginResolutionException( plugin, e );