From fdfb9d5a2dd94d7fc06a737b927c7b24416718aa Mon Sep 17 00:00:00 2001 From: John Dennis Casey Date: Sat, 18 Jun 2005 04:23:20 +0000 Subject: [PATCH] Changing to in the reporting section. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@191266 13f79535-47bb-0310-9956-ffa450edef68 --- .../version/DefaultPluginVersionManager.java | 12 +++--- maven-model/maven.mdo | 33 +++++++-------- .../org/apache/maven/doxia/DoxiaMojo.java | 7 ++-- .../apache/maven/project/MavenProject.java | 4 +- .../DefaultModelInheritanceAssembler.java | 42 ++++++++++--------- 5 files changed, 51 insertions(+), 47 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java b/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java index f43ace708c..31b2662638 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java @@ -6,7 +6,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolver; 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.PluginRegistry; 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)?? // 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; } diff --git a/maven-model/maven.mdo b/maven-model/maven.mdo index 47e20bbe44..7f1b1527b1 100644 --- a/maven-model/maven.mdo +++ b/maven-model/maven.mdo @@ -2316,12 +2316,11 @@ Where to store all of the generated reports - reporters + plugins 4.0.0 - The reporters (specialized plugins) to use and their configuration + The report plugins) to use and their configuration - - Reporter + ReportPlugin * @@ -2330,28 +2329,28 @@ 4.0.0 @@ -2485,8 +2484,8 @@ - - Reporter + + ReportPlugin 4.0.0 diff --git a/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java b/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java index 6bf2ae6a52..7f1a0406ed 100644 --- a/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java +++ b/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/doxia/DoxiaMojo.java @@ -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? - List reportPlugins = project.getReporters(); + List reportPlugins = project.getReportPlugins(); + if ( reportPlugins != null ) { 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 { - pluginManager.verifyPlugin( reporter.getGroupId(), reporter.getArtifactId(), reporter.getVersion(), + pluginManager.verifyPlugin( reportPlugin.getGroupId(), reportPlugin.getArtifactId(), reportPlugin.getVersion(), project, settings, localRepository ); } catch ( ArtifactResolutionException e ) diff --git a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java index fd044da587..8d6cb28ab9 100644 --- a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java @@ -706,13 +706,13 @@ public class MavenProject // Plugins // ---------------------------------------------------------------------- - public List getReporters() + public List getReportPlugins() { if ( model.getReporting() == null ) { return null; } - return model.getReporting().getReporters(); + return model.getReporting().getPlugins(); } diff --git a/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java b/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java index 14e59d8c9d..e006e72535 100644 --- a/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java +++ b/maven-project/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java @@ -24,8 +24,8 @@ import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.Model; import org.apache.maven.model.ModelBase; import org.apache.maven.model.Profile; +import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.ReportSet; -import org.apache.maven.model.Reporter; import org.apache.maven.model.Reporting; import org.apache.maven.model.Repository; import org.apache.maven.model.Scm; @@ -213,38 +213,38 @@ public class DefaultModelInheritanceAssembler 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() ) { - 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 ) ) { - 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(); - 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 ); } - private void mergeReporters( Reporter dominant, Reporter recessive ) + private void mergeReportPlugins( ReportPlugin dominant, ReportPlugin recessive ) { if ( StringUtils.isEmpty( dominant.getVersion() ) ) { @@ -350,6 +352,8 @@ public class DefaultModelInheritanceAssembler } dominant.setReportSets( new ArrayList( mergedReportSets.values() ) ); + + dominant.flushReportSetMap(); } private void assembleDependencyManagementInheritance( ModelBase child, ModelBase parent )