PR: MNG-902

add default reports

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290654 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-21 08:40:42 +00:00
parent 1fcc547ee6
commit ec2ece5a3b
4 changed files with 88 additions and 15 deletions

View File

@ -91,6 +91,8 @@ public class DefaultLifecycleExecutor
private ArtifactHandlerManager artifactHandlerManager;
private List defaultReports;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
@ -517,6 +519,53 @@ public class DefaultLifecycleExecutor
"DEPRECATED: 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, ":" );
if ( tok.countTokens() != 2 )
{
getLogger().warn( "Invalid default report ignored: '" + report + "' (must be groupId:artifactId)" );
}
else
{
String groupId = tok.nextToken();
String artifactId = tok.nextToken();
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 );
reportPlugins.add( reportPlugin );
}
}
}
}
List reports = new ArrayList();
if ( reportPlugins != null )
{

View File

@ -493,29 +493,31 @@ public class DefaultPluginVersionManager
if ( resolveAsReportPlugin )
{
for ( Iterator it = project.getReportPlugins().iterator(); it.hasNext(); )
if ( project.getReportPlugins() != null )
{
ReportPlugin plugin = (ReportPlugin) it.next();
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
for ( Iterator it = project.getReportPlugins().iterator(); it.hasNext() && version == null; )
{
version = plugin.getVersion();
ReportPlugin plugin = (ReportPlugin) it.next();
break;
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
{
version = plugin.getVersion();
}
}
}
}
else
{
for ( Iterator it = project.getBuildPlugins().iterator(); it.hasNext(); )
if ( project.getBuildPlugins() != null )
{
Plugin plugin = (Plugin) it.next();
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
for ( Iterator it = project.getBuildPlugins().iterator(); it.hasNext() && version == null; )
{
version = plugin.getVersion();
Plugin plugin = (Plugin) it.next();
break;
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
{
version = plugin.getVersion();
}
}
}
}

View File

@ -168,6 +168,20 @@
<phase implementation="java.lang.String">deploy</phase>
</phases>
<!-- END SNIPPET: lifecycle -->
<!-- START SNIPPET: default-reports -->
<defaultReports>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-project-info-reports-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-checkstyle-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-javadoc-plugin</report>
<!-- TODO: currently in mojo - should they be defaults any more?
<report implementation="java.lang.String">org.apache.maven.plugins:maven-changelog-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-surefire-report-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-jdepend-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-jxr-plugin</report>
<report implementation="java.lang.String">org.apache.maven.plugins:maven-taglist-plugin</report>
-->
</defaultReports>
<!-- END SNIPPET: default-reports -->
<!-- START SNIPPET: default-lifecycle -->
<!-- NOT USED, ACCORDING TO CODE.
<defaultPhases>

View File

@ -1298,7 +1298,8 @@
<field>
<name>systemPath</name>
<version>4.0.0</version>
<description>FOR SYSTEM SCOPE ONLY. This specifies the path on the filesystem for this dependency.</description>
<description>FOR SYSTEM SCOPE ONLY. This specifies the path on the filesystem for this
dependency.</description>
<type>String</type>
</field>
<field>
@ -2544,6 +2545,13 @@
<version>4.0.0</version>
<description>Section for management of reports and configuration</description>
<fields>
<field>
<name>excludeDefaults</name>
<version>4.0.0</version>
<type>boolean</type>
<description>If true, then the default reports are not included in the site generation</description>
<defaultValue>false</defaultValue>
</field>
<field>
<name>outputDirectory</name>
<version>4.0.0</version>
@ -2654,7 +2662,7 @@
</codeSegment>
</codeSegments>
</class>
<class>
<class>
<name>Activation</name>
<version>4.0.0</version>
<description><![CDATA[
@ -2693,7 +2701,7 @@
Specifies that this profile will be activated based on existence of a file.
]]></description>
<association>
<type>ActivationFile</type>
<type>ActivationFile</type>
</association>
</field>
</fields>