MavenProject project = mavenReportExecutorRequest.getProject();
// search in the build section
if ( project.getBuild() != null )
{
Plugin plugin = find( reportPlugin, project.getBuild().getPlugins() );
if ( plugin != null && plugin.getVersion() != null )
{
if ( getLog().isDebugEnabled() )
{
logger.debug( "resolved " + reportPluginKey + " version from the build.plugins section: "
+ plugin.getVersion() );
}
return plugin.getVersion();
}
}
// search in pluginManagement section
if ( project.getBuild() != null && project.getBuild().getPluginManagement() != null )
{
Plugin plugin = find( reportPlugin, project.getBuild().getPluginManagement().getPlugins() );
if ( plugin != null && plugin.getVersion() != null )
{
if ( getLog().isDebugEnabled() )
{
logger.debug( "resolved " + reportPluginKey
+ " version from the build.pluginManagement.plugins section: " + plugin.getVersion() );
}
return plugin.getVersion();
}
}
logger.warn( "Report plugin " + reportPluginKey + " has an empty version." );
logger.warn( "" );
logger.warn( "It is highly recommended to fix these problems"
+ " because they threaten the stability of your build." );
logger.warn( "" );
logger.warn( "For this reason, future Maven versions might no"
+ " longer support building such malformed projects." );
Plugin plugin = new Plugin();
plugin.setGroupId( reportPlugin.getGroupId() );
plugin.setArtifactId( reportPlugin.getArtifactId() );
PluginVersionRequest pluginVersionRequest =
new DefaultPluginVersionRequest( plugin, mavenReportExecutorRequest.getMavenSession() );
PluginVersionResult result = pluginVersionResolver.resolve( pluginVersionRequest );