in maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java [832:918]
private List getReportExecutions( final MavenProject project, final Stack forkEntryPoints, final MojoExecution mojoExecution, final MavenSession session )
throws LifecycleExecutionException, PluginNotFoundException
{
List reportPlugins = project.getReportPlugins();
if ( project.getModel().getReports() != null )
{
getLogger().error(
"Plugin contains a <reports/> section: this is IGNORED - please use <reporting/> instead." );
}
if ( project.getReporting() == null || !project.getReporting().isExcludeDefaults() )
{
if ( reportPlugins == null )
{
reportPlugins = new ArrayList();
}
else
{
reportPlugins = new ArrayList( reportPlugins );
}
for ( Iterator i = defaultReports.iterator(); i.hasNext(); )
{
String report = (String) i.next();
StringTokenizer tok = new StringTokenizer( report, ":" );
int count = tok.countTokens();
if ( count != 2 && count != 3 )
{
getLogger().warn( "Invalid default report ignored: '" + report + "' (must be groupId:artifactId[:version])" );
}
else
{
String groupId = tok.nextToken();
String artifactId = tok.nextToken();
String version = tok.hasMoreTokens() ? tok.nextToken() : null;
boolean found = false;
for ( Iterator j = reportPlugins.iterator(); j.hasNext() && !found; )
{
ReportPlugin reportPlugin = (ReportPlugin) j.next();
if ( reportPlugin.getGroupId().equals( groupId )
&& reportPlugin.getArtifactId().equals( artifactId ) )
{
found = true;
}
}
if ( !found )
{
ReportPlugin reportPlugin = new ReportPlugin();
reportPlugin.setGroupId( groupId );
reportPlugin.setArtifactId( artifactId );
reportPlugin.setVersion( version );
reportPlugins.add( reportPlugin );
}
}
}
}
List reports = new ArrayList();
if ( reportPlugins != null )
{
for ( Iterator it = reportPlugins.iterator(); it.hasNext(); )
{
ReportPlugin reportPlugin = (ReportPlugin) it.next();
List reportSets = reportPlugin.getReportSets();
if ( reportSets == null || reportSets.isEmpty() )
{
reports.addAll( getReportExecutions( reportPlugin, forkEntryPoints, null, project, session, mojoExecution ) );
}
else
{
for ( Iterator j = reportSets.iterator(); j.hasNext(); )
{
ReportSet reportSet = (ReportSet) j.next();
reports.addAll( getReportExecutions( reportPlugin, forkEntryPoints, reportSet, project, session, mojoExecution ) );
}
}
}
}
return reports;
}