Changing <reporter/> to <plugin/> in the reporting section.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@191266 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-06-18 04:23:20 +00:00
parent d82ab9aed6
commit fdfb9d5a2d
5 changed files with 51 additions and 47 deletions

View File

@ -6,7 +6,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
import org.apache.maven.model.Reporter; import org.apache.maven.model.ReportPlugin;
import org.apache.maven.plugin.registry.MavenPluginRegistryBuilder; import org.apache.maven.plugin.registry.MavenPluginRegistryBuilder;
import org.apache.maven.plugin.registry.PluginRegistry; import org.apache.maven.plugin.registry.PluginRegistry;
import org.apache.maven.plugin.registry.PluginRegistryUtils; import org.apache.maven.plugin.registry.PluginRegistryUtils;
@ -398,15 +398,15 @@ public class DefaultPluginVersionManager
// won't this overwrite the above loop if it exists in both places (unlikely, I know)?? // won't this overwrite the above loop if it exists in both places (unlikely, I know)??
// maybe that's the idea...? // maybe that's the idea...?
if ( project.getReporters() != null ) if ( project.getReportPlugins() != null )
{ {
for ( Iterator it = project.getReporters().iterator(); it.hasNext(); ) for ( Iterator it = project.getReportPlugins().iterator(); it.hasNext(); )
{ {
Reporter reporter = (Reporter) it.next(); ReportPlugin reportPlugin = (ReportPlugin) it.next();
if ( groupId.equals( reporter.getGroupId() ) && artifactId.equals( reporter.getArtifactId() ) ) if ( groupId.equals( reportPlugin.getGroupId() ) && artifactId.equals( reportPlugin.getArtifactId() ) )
{ {
version = reporter.getVersion(); version = reportPlugin.getVersion();
break; break;
} }

View File

@ -2316,12 +2316,11 @@
<description>Where to store all of the generated reports</description> <description>Where to store all of the generated reports</description>
</field> </field>
<field> <field>
<name>reporters</name> <name>plugins</name>
<version>4.0.0</version> <version>4.0.0</version>
<description>The reporters (specialized plugins) to use and their configuration</description> <description>The report plugins) to use and their configuration</description>
<association> <association>
<!-- TODO: goal stuff relevant or not? --> <type>ReportPlugin</type>
<type>Reporter</type>
<multiplicity>*</multiplicity> <multiplicity>*</multiplicity>
</association> </association>
</field> </field>
@ -2330,28 +2329,28 @@
<codeSegment> <codeSegment>
<version>4.0.0</version> <version>4.0.0</version>
<code><![CDATA[ <code><![CDATA[
Map reporterMap; Map reportPluginMap;
public void flushReporterMap() public void flushReportPluginMap()
{ {
this.reporterMap = null; this.reportPluginMap = null;
} }
public Map getReportersAsMap() public Map getReportPluginsAsMap()
{ {
if ( reporterMap == null ) if ( reportPluginMap == null )
{ {
reporterMap = new HashMap(); reportPluginMap = new HashMap();
if ( getReporters() != null ) if ( getPlugins() != null )
{ {
for ( Iterator it = getReporters().iterator(); it.hasNext(); ) for ( Iterator it = getPlugins().iterator(); it.hasNext(); )
{ {
Reporter reporter = (Reporter) it.next(); ReportPlugin reportPlugin = (ReportPlugin) it.next();
reporterMap.put( reporter.getKey(), reporter ); reportPluginMap.put( reportPlugin.getKey(), reportPlugin );
} }
} }
} }
return reporterMap; return reportPluginMap;
} }
]]></code> ]]></code>
</codeSegment> </codeSegment>
@ -2485,8 +2484,8 @@
</fields> </fields>
</class> </class>
<!-- /BuildProfile support --> <!-- /BuildProfile support -->
<class> <class xml.tagName="plugin">
<name>Reporter</name> <name>ReportPlugin</name>
<version>4.0.0</version> <version>4.0.0</version>
<fields> <fields>
<field> <field>

View File

@ -717,15 +717,16 @@ public class DoxiaMojo
{ {
// TODO: not the best solution. Perhaps a mojo tag that causes the plugin manager to populate project reports instead? // TODO: not the best solution. Perhaps a mojo tag that causes the plugin manager to populate project reports instead?
List reportPlugins = project.getReporters(); List reportPlugins = project.getReportPlugins();
if ( reportPlugins != null ) if ( reportPlugins != null )
{ {
for ( Iterator it = reportPlugins.iterator(); it.hasNext(); ) for ( Iterator it = reportPlugins.iterator(); it.hasNext(); )
{ {
org.apache.maven.model.Reporter reporter = (org.apache.maven.model.Reporter) it.next(); org.apache.maven.model.ReportPlugin reportPlugin = (org.apache.maven.model.ReportPlugin) it.next();
try try
{ {
pluginManager.verifyPlugin( reporter.getGroupId(), reporter.getArtifactId(), reporter.getVersion(), pluginManager.verifyPlugin( reportPlugin.getGroupId(), reportPlugin.getArtifactId(), reportPlugin.getVersion(),
project, settings, localRepository ); project, settings, localRepository );
} }
catch ( ArtifactResolutionException e ) catch ( ArtifactResolutionException e )

View File

@ -706,13 +706,13 @@ public class MavenProject
// Plugins // Plugins
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
public List getReporters() public List getReportPlugins()
{ {
if ( model.getReporting() == null ) if ( model.getReporting() == null )
{ {
return null; return null;
} }
return model.getReporting().getReporters(); return model.getReporting().getPlugins();
} }

View File

@ -24,8 +24,8 @@ import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.model.ModelBase; import org.apache.maven.model.ModelBase;
import org.apache.maven.model.Profile; import org.apache.maven.model.Profile;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.model.ReportSet; import org.apache.maven.model.ReportSet;
import org.apache.maven.model.Reporter;
import org.apache.maven.model.Reporting; import org.apache.maven.model.Reporting;
import org.apache.maven.model.Repository; import org.apache.maven.model.Repository;
import org.apache.maven.model.Scm; import org.apache.maven.model.Scm;
@ -213,38 +213,38 @@ public class DefaultModelInheritanceAssembler
childReporting.setOutputDirectory( parentReporting.getOutputDirectory() ); childReporting.setOutputDirectory( parentReporting.getOutputDirectory() );
} }
Map mergedReporters = new HashMap(); Map mergedReportPlugins = new HashMap();
Map childReportersByKey = childReporting.getReportersAsMap(); Map childReportersByKey = childReporting.getReportPluginsAsMap();
List parentReporters = parentReporting.getReporters(); List parentReportPlugins = parentReporting.getPlugins();
if ( parentReporters != null ) if ( parentReportPlugins != null )
{ {
for ( Iterator it = parentReporters.iterator(); it.hasNext(); ) for ( Iterator it = parentReportPlugins.iterator(); it.hasNext(); )
{ {
Reporter parentReporter = (Reporter) it.next(); ReportPlugin parentReportPlugin = (ReportPlugin) it.next();
String inherited = parentReporter.getInherited(); String inherited = parentReportPlugin.getInherited();
if ( StringUtils.isEmpty( inherited ) || Boolean.valueOf( inherited ).booleanValue() ) if ( StringUtils.isEmpty( inherited ) || Boolean.valueOf( inherited ).booleanValue() )
{ {
Reporter childReporter = (Reporter) childReportersByKey.get( parentReporter.getKey() ); ReportPlugin childReportPlugin = (ReportPlugin) childReportersByKey.get( parentReportPlugin.getKey() );
Reporter mergedReporter = parentReporter; ReportPlugin mergedReportPlugin = parentReportPlugin;
if ( childReporter != null ) if ( childReportPlugin != null )
{ {
mergedReporter = childReporter; mergedReportPlugin = childReportPlugin;
mergeReporters( childReporter, parentReporter ); mergeReportPlugins( childReportPlugin, parentReportPlugin );
} }
else if ( StringUtils.isEmpty( inherited ) ) else if ( StringUtils.isEmpty( inherited ) )
{ {
mergedReporter.unsetInheritanceApplied(); mergedReportPlugin.unsetInheritanceApplied();
} }
mergedReporters.put( mergedReporter.getKey(), mergedReporter ); mergedReportPlugins.put( mergedReportPlugin.getKey(), mergedReportPlugin );
} }
} }
} }
@ -255,19 +255,21 @@ public class DefaultModelInheritanceAssembler
String key = (String) entry.getKey(); String key = (String) entry.getKey();
if ( !mergedReporters.containsKey( key ) ) if ( !mergedReportPlugins.containsKey( key ) )
{ {
mergedReporters.put( key, entry.getValue() ); mergedReportPlugins.put( key, entry.getValue() );
} }
} }
childReporting.setReporters( new ArrayList( mergedReporters.values() ) ); childReporting.setPlugins( new ArrayList( mergedReportPlugins.values() ) );
childReporting.flushReportPluginMap();
} }
assembleDependencyManagementInheritance( child, parent ); assembleDependencyManagementInheritance( child, parent );
} }
private void mergeReporters( Reporter dominant, Reporter recessive ) private void mergeReportPlugins( ReportPlugin dominant, ReportPlugin recessive )
{ {
if ( StringUtils.isEmpty( dominant.getVersion() ) ) if ( StringUtils.isEmpty( dominant.getVersion() ) )
{ {
@ -350,6 +352,8 @@ public class DefaultModelInheritanceAssembler
} }
dominant.setReportSets( new ArrayList( mergedReportSets.values() ) ); dominant.setReportSets( new ArrayList( mergedReportSets.values() ) );
dominant.flushReportSetMap();
} }
private void assembleDependencyManagementInheritance( ModelBase child, ModelBase parent ) private void assembleDependencyManagementInheritance( ModelBase child, ModelBase parent )