diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index 6b24ca9e01..913f4275f0 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -19,7 +19,6 @@
org.apache.maven.reporting
maven-reporting-api
2.0-beta-1-SNAPSHOT
- runtime
org.apache.maven
@@ -122,7 +121,7 @@
org.apache.maven.plugins
- maven-project-info-reports-plugin
+ maven-clover-plugin
org.apache.maven.plugins
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
index 0dfd595c68..45d83462fb 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
@@ -52,6 +52,7 @@ import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.artifact.MavenMetadataSource;
import org.apache.maven.project.path.PathTranslator;
import org.apache.maven.settings.Settings;
+import org.apache.maven.reporting.MavenReport;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusContainerException;
@@ -286,7 +287,7 @@ public class DefaultPluginManager
dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() );
}
- plugin = getConfiguredMojo( mojoDescriptor, session, dom, project );
+ plugin = getConfiguredMojo( mojoDescriptor, session, dom, project, false );
}
catch ( PluginConfigurationException e )
{
@@ -375,7 +376,11 @@ public class DefaultPluginManager
Xpp3Dom dom = project.getReportConfiguration( reportPlugin.getGroupId(),
reportPlugin.getArtifactId(), executionId );
- reports.add( getConfiguredMojo( mojoDescriptor, session, dom, project ) );
+ Mojo reportMojo = getConfiguredMojo( mojoDescriptor, session, dom, project, true );
+ if ( reportMojo != null )
+ {
+ reports.add( reportMojo );
+ }
}
catch ( ComponentLookupException e )
{
@@ -401,19 +406,24 @@ public class DefaultPluginManager
}
private Mojo getConfiguredMojo( MojoDescriptor mojoDescriptor, MavenSession session, Xpp3Dom dom,
- MavenProject project )
+ MavenProject project, boolean report )
throws ComponentLookupException, PluginConfigurationException, PluginManagerException
{
- PlexusContainer pluginContainer = getPluginContainer( mojoDescriptor.getPluginDescriptor() );
-
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
+ PlexusContainer pluginContainer = getPluginContainer( pluginDescriptor );
+
// if this is the first time this plugin has been used, the plugin's container will only
// contain the plugin's artifact in isolation; we need to finish resolving the plugin's
// dependencies, and add them to the container.
ensurePluginContainerIsComplete( pluginDescriptor, pluginContainer, project, session );
Mojo plugin = (Mojo) pluginContainer.lookup( Mojo.ROLE, mojoDescriptor.getRoleHint() );
+ if ( report && !( plugin instanceof MavenReport ) )
+ {
+ // TODO: the mojoDescriptor should actually capture this information so we don't get this far
+ return null;
+ }
plugin.setLog( mojoLogger );
diff --git a/maven-plugins/maven-clover-plugin/pom.xml b/maven-plugins/maven-clover-plugin/pom.xml
index 2c0d29a24c..391dad4c8e 100644
--- a/maven-plugins/maven-clover-plugin/pom.xml
+++ b/maven-plugins/maven-clover-plugin/pom.xml
@@ -41,8 +41,8 @@
org.apache.maven.reporting
- maven-reporting-api
- 2.0-alpha-3
+ maven-reporting-impl
+ 2.0-beta-1-SNAPSHOT
clover
diff --git a/maven-plugins/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java b/maven-plugins/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
index 9b3348a463..53a7821b63 100644
--- a/maven-plugins/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
+++ b/maven-plugins/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
@@ -1,234 +1,234 @@
-package org.apache.maven.plugin.pmd;
-
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import net.sourceforge.pmd.PMD;
-import net.sourceforge.pmd.PMDException;
-import net.sourceforge.pmd.Report;
-import net.sourceforge.pmd.RuleContext;
-import net.sourceforge.pmd.RuleSet;
-import net.sourceforge.pmd.RuleSetFactory;
-
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.reporting.AbstractMavenReport;
-import org.apache.maven.reporting.MavenReportException;
-import org.codehaus.doxia.sink.Sink;
-import org.codehaus.doxia.site.renderer.SiteRenderer;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.StringUtils;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * Implement the PMD report.
- *
- * @goal pmd
- *
- * @todo needs to support the multiple source roots
- * @author Brett Porter
- * @version $Id: PmdReport.java,v 1.3 2005/02/23 00:08:53 brett Exp $
- */
-public class PmdReport
- extends AbstractMavenReport
-{
- /**
- * @parameter expression="${project.build.directory}/site"
- * @required
- */
- private String outputDirectory;
-
- /**
- * @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}"
- * @required
- * @readonly
- */
- private SiteRenderer siteRenderer;
-
- /**
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- private MavenProject project;
-
- /**
- * @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale)
- */
- public String getName( Locale locale )
- {
- return getBundle( locale ).getString( "report.pmd.name" );
- }
-
- /**
- * @see org.apache.maven.reporting.MavenReport#getDescription(java.util.Locale)
- */
- public String getDescription( Locale locale )
- {
- return getBundle( locale ).getString( "report.pmd.description" );
- }
-
- /**
- * @see org.apache.maven.reporting.AbstractMavenReport#getOutputDirectory()
- */
- protected String getOutputDirectory()
- {
- return outputDirectory;
- }
-
- /**
- * @see org.apache.maven.reporting.AbstractMavenReport#getProject()
- */
- protected MavenProject getProject()
- {
- return project;
- }
-
- /**
- * @see org.apache.maven.reporting.AbstractMavenReport#getSiteRenderer()
- */
- protected SiteRenderer getSiteRenderer()
- {
- return siteRenderer;
- }
-
- /**
- * @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
- */
- public void executeReport( Locale locale )
- throws MavenReportException
- {
- Sink sink = getSink();
-
- PMD pmd = new PMD();
- RuleContext ruleContext = new RuleContext();
- Report report = new Report();
- // TODO: use source roots instead
- String sourceDirectory = getProject().getBuild().getSourceDirectory();
- PmdReportListener reportSink = new PmdReportListener( sink, sourceDirectory, getBundle( locale ) );
- report.addListener( reportSink );
- ruleContext.setReport( report );
-
- RuleSetFactory ruleSetFactory = new RuleSetFactory();
- InputStream rulesInput = pmd.getClass().getResourceAsStream( "/rulesets/controversial.xml" );
- RuleSet ruleSet = ruleSetFactory.createRuleSet( rulesInput );
-
- reportSink.beginDocument();
-
- List files;
- try
- {
- files = getFilesToProcess( "**/*.java", null );
- }
- catch ( IOException e )
- {
- throw new MavenReportException( "Can't parse " + sourceDirectory, e );
- }
-
- for ( Iterator i = files.iterator(); i.hasNext(); )
- {
- File file = (File) i.next();
- FileReader fileReader;
- try
- {
- fileReader = new FileReader( file );
- }
- catch ( FileNotFoundException e )
- {
- throw new MavenReportException( "Error opening source file: " + file, e );
- }
-
- try
- {
- // TODO: lazily call beginFile in case there are no rules
-
- reportSink.beginFile( file );
- ruleContext.setSourceCodeFilename( file.getAbsolutePath() );
- pmd.processFile( fileReader, ruleSet, ruleContext );
- reportSink.endFile( file );
- }
- catch ( PMDException e )
- {
- Exception ex = e;
- if ( e.getReason() != null )
- {
- ex = e.getReason();
- }
- throw new MavenReportException( "Failure executing PMD for: " + file, ex );
- }
- finally
- {
- try
- {
- fileReader.close();
- }
- catch ( IOException e )
- {
- throw new MavenReportException( "Error closing source file: " + file, e );
- }
- }
- }
- reportSink.endDocument();
- }
-
- /**
- * @see org.apache.maven.reporting.MavenReport#getOutputName()
- */
- public String getOutputName()
- {
- return "pmd";
- }
-
- private List getFilesToProcess( String includes, String excludes )
- throws IOException
- {
- File dir = new File( getProject().getBuild().getSourceDirectory() );
- if ( !dir.exists() )
- {
- return Collections.EMPTY_LIST;
- }
-
- StringBuffer excludesStr = new StringBuffer();
- if ( StringUtils.isNotEmpty( excludes ) )
- {
- excludesStr.append( excludes );
- }
- for ( int i = 0; i < DEFAULT_EXCLUDES.length; i++ )
- {
- if ( excludesStr.length() > 0 )
- {
- excludesStr.append( "," );
- }
- excludesStr.append( DEFAULT_EXCLUDES[i] );
- }
-
- return FileUtils.getFiles( dir, includes, excludesStr.toString() );
- }
-
- private static ResourceBundle getBundle( Locale locale )
- {
- return ResourceBundle.getBundle("pmd-report", locale, PmdReport.class.getClassLoader() );
- }
-}
+package org.apache.maven.plugin.pmd;
+
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import net.sourceforge.pmd.PMD;
+import net.sourceforge.pmd.PMDException;
+import net.sourceforge.pmd.Report;
+import net.sourceforge.pmd.RuleContext;
+import net.sourceforge.pmd.RuleSet;
+import net.sourceforge.pmd.RuleSetFactory;
+
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.AbstractMavenReport;
+import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.doxia.sink.Sink;
+import org.codehaus.doxia.site.renderer.SiteRenderer;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Implement the PMD report.
+ *
+ * @goal pmd
+ *
+ * @todo needs to support the multiple source roots
+ * @author Brett Porter
+ * @version $Id: PmdReport.java,v 1.3 2005/02/23 00:08:53 brett Exp $
+ */
+public class PmdReport
+ extends AbstractMavenReport
+{
+ /**
+ * @parameter expression="${project.build.directory}/site"
+ * @required
+ */
+ private String outputDirectory;
+
+ /**
+ * @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}"
+ * @required
+ * @readonly
+ */
+ private SiteRenderer siteRenderer;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale)
+ */
+ public String getName( Locale locale )
+ {
+ return getBundle( locale ).getString( "report.pmd.name" );
+ }
+
+ /**
+ * @see org.apache.maven.reporting.MavenReport#getDescription(java.util.Locale)
+ */
+ public String getDescription( Locale locale )
+ {
+ return getBundle( locale ).getString( "report.pmd.description" );
+ }
+
+ /**
+ * @see org.apache.maven.reporting.AbstractMavenReport#getOutputDirectory()
+ */
+ protected String getOutputDirectory()
+ {
+ return outputDirectory;
+ }
+
+ /**
+ * @see org.apache.maven.reporting.AbstractMavenReport#getProject()
+ */
+ protected MavenProject getProject()
+ {
+ return project;
+ }
+
+ /**
+ * @see org.apache.maven.reporting.AbstractMavenReport#getSiteRenderer()
+ */
+ protected SiteRenderer getSiteRenderer()
+ {
+ return siteRenderer;
+ }
+
+ /**
+ * @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
+ */
+ public void executeReport( Locale locale )
+ throws MavenReportException
+ {
+ Sink sink = getSink();
+
+ PMD pmd = new PMD();
+ RuleContext ruleContext = new RuleContext();
+ Report report = new Report();
+ // TODO: use source roots instead
+ String sourceDirectory = getProject().getBuild().getSourceDirectory();
+ PmdReportListener reportSink = new PmdReportListener( sink, sourceDirectory, getBundle( locale ) );
+ report.addListener( reportSink );
+ ruleContext.setReport( report );
+
+ RuleSetFactory ruleSetFactory = new RuleSetFactory();
+ InputStream rulesInput = pmd.getClass().getResourceAsStream( "/rulesets/controversial.xml" );
+ RuleSet ruleSet = ruleSetFactory.createRuleSet( rulesInput );
+
+ reportSink.beginDocument();
+
+ List files;
+ try
+ {
+ files = getFilesToProcess( "**/*.java", null );
+ }
+ catch ( IOException e )
+ {
+ throw new MavenReportException( "Can't parse " + sourceDirectory, e );
+ }
+
+ for ( Iterator i = files.iterator(); i.hasNext(); )
+ {
+ File file = (File) i.next();
+ FileReader fileReader;
+ try
+ {
+ fileReader = new FileReader( file );
+ }
+ catch ( FileNotFoundException e )
+ {
+ throw new MavenReportException( "Error opening source file: " + file, e );
+ }
+
+ try
+ {
+ // TODO: lazily call beginFile in case there are no rules
+
+ reportSink.beginFile( file );
+ ruleContext.setSourceCodeFilename( file.getAbsolutePath() );
+ pmd.processFile( fileReader, ruleSet, ruleContext );
+ reportSink.endFile( file );
+ }
+ catch ( PMDException e )
+ {
+ Exception ex = e;
+ if ( e.getReason() != null )
+ {
+ ex = e.getReason();
+ }
+ throw new MavenReportException( "Failure executing PMD for: " + file, ex );
+ }
+ finally
+ {
+ try
+ {
+ fileReader.close();
+ }
+ catch ( IOException e )
+ {
+ throw new MavenReportException( "Error closing source file: " + file, e );
+ }
+ }
+ }
+ reportSink.endDocument();
+ }
+
+ /**
+ * @see org.apache.maven.reporting.MavenReport#getOutputName()
+ */
+ public String getOutputName()
+ {
+ return "pmd";
+ }
+
+ private List getFilesToProcess( String includes, String excludes )
+ throws IOException
+ {
+ File dir = new File( getProject().getBuild().getSourceDirectory() );
+ if ( !dir.exists() )
+ {
+ return Collections.EMPTY_LIST;
+ }
+
+ StringBuffer excludesStr = new StringBuffer();
+ if ( StringUtils.isNotEmpty( excludes ) )
+ {
+ excludesStr.append( excludes );
+ }
+ for ( int i = 0; i < DEFAULT_EXCLUDES.length; i++ )
+ {
+ if ( excludesStr.length() > 0 )
+ {
+ excludesStr.append( "," );
+ }
+ excludesStr.append( DEFAULT_EXCLUDES[i] );
+ }
+
+ return FileUtils.getFiles( dir, includes, excludesStr.toString() );
+ }
+
+ private static ResourceBundle getBundle( Locale locale )
+ {
+ return ResourceBundle.getBundle("pmd-report", locale, PmdReport.class.getClassLoader() );
+ }
+}
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 d48fce896a..ca58455e25 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
@@ -908,19 +908,6 @@ public class DoxiaMojo
{
ReportPlugin reportPlugin = (ReportPlugin) it.next();
-// try
-// {
-// pluginManager.verifyPlugin( reportPlugin, project, settings, localRepository );
-// }
-// catch ( PluginVersionResolutionException e )
-// {
-// throw new MojoExecutionException( "Cannot resolve version for report plugin", e );
-// }
-// catch ( PluginManagerException e )
-// {
-// throw new MojoExecutionException( "Cannot find report plugin", e );
-// }
-
try
{
List reportSets = reportPlugin.getReportSets();
@@ -943,16 +930,7 @@ public class DoxiaMojo
}
}
- for ( Iterator i = reportsList.iterator(); i.hasNext(); )
- {
- Object obj = i.next();
-
- //TODO: Remove this test when getReports will return only reports object
- if ( obj instanceof MavenReport )
- {
- reports.add( obj );
- }
- }
+ reports.addAll( reportsList );
}
catch ( PluginManagerException e )
{