PR: MNG-530

don't attempt to configure non-report mojos during reporting



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@220042 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-07-21 12:18:35 +00:00
parent 1af333b028
commit ed7ccf707a
5 changed files with 253 additions and 266 deletions

View File

@ -19,7 +19,6 @@
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>2.0-beta-1-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
@ -122,7 +121,7 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<artifactId>maven-clover-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -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 );

View File

@ -41,8 +41,8 @@
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>2.0-alpha-3</version>
<artifactId>maven-reporting-impl</artifactId>
<version>2.0-beta-1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>clover</groupId>

View File

@ -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 )
{