mirror of https://github.com/apache/maven.git
o removing reporting completely
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@759553 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7d358ccdd6
commit
44003021ea
|
@ -53,8 +53,6 @@ public class MavenSession
|
||||||
|
|
||||||
private MavenProject currentProject;
|
private MavenProject currentProject;
|
||||||
|
|
||||||
private Map reports = new LinkedHashMap();
|
|
||||||
|
|
||||||
// Used by the embedder to verifyPlugin
|
// Used by the embedder to verifyPlugin
|
||||||
public MavenSession( PlexusContainer container, MavenExecutionRequest request )
|
public MavenSession( PlexusContainer container, MavenExecutionRequest request )
|
||||||
{
|
{
|
||||||
|
@ -150,47 +148,6 @@ public class MavenSession
|
||||||
return currentProject;
|
return currentProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the list of reports ({@link MavenReport} instances) that have been executed against
|
|
||||||
* this project, for use in another mojo's execution.
|
|
||||||
*/
|
|
||||||
public List getReports()
|
|
||||||
{
|
|
||||||
if ( reports == null )
|
|
||||||
{
|
|
||||||
return Collections.EMPTY_LIST;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ArrayList( reports.values() );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the reports for this project
|
|
||||||
*/
|
|
||||||
public void clearReports()
|
|
||||||
{
|
|
||||||
reports.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a newly-executed report ({@link MavenReport} instance) to the reports collection, for
|
|
||||||
* future reference.
|
|
||||||
*/
|
|
||||||
public void addReport( MojoDescriptor mojoDescriptor, MavenReport report )
|
|
||||||
{
|
|
||||||
reports.put( mojoDescriptor, report );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set getReportMojoDescriptors()
|
|
||||||
{
|
|
||||||
if ( reports == null )
|
|
||||||
{
|
|
||||||
return Collections.EMPTY_SET;
|
|
||||||
}
|
|
||||||
|
|
||||||
return reports.keySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectBuilderConfiguration getProjectBuilderConfiguration()
|
public ProjectBuilderConfiguration getProjectBuilderConfiguration()
|
||||||
{
|
{
|
||||||
return request.getProjectBuildingConfiguration();
|
return request.getProjectBuildingConfiguration();
|
||||||
|
|
|
@ -55,7 +55,6 @@ import org.apache.maven.model.Dependency;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
import org.apache.maven.model.PluginExecution;
|
import org.apache.maven.model.PluginExecution;
|
||||||
import org.apache.maven.model.ReportPlugin;
|
|
||||||
import org.apache.maven.monitor.logging.DefaultLog;
|
import org.apache.maven.monitor.logging.DefaultLog;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.Parameter;
|
import org.apache.maven.plugin.descriptor.Parameter;
|
||||||
|
@ -583,15 +582,6 @@ public class DefaultPluginManager
|
||||||
{
|
{
|
||||||
throw new PluginExecutionException( mojoExecution, project, e );
|
throw new PluginExecutionException( mojoExecution, project, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEW: If the mojo that just executed is a report, store it in the LifecycleExecutionContext
|
|
||||||
// for reference by future mojos.
|
|
||||||
if ( mojo instanceof MavenReport )
|
|
||||||
{
|
|
||||||
session.addReport( mojoDescriptor, (MavenReport) mojo );
|
|
||||||
}
|
|
||||||
|
|
||||||
//dispatcher.dispatchEnd( event, goalExecId );
|
|
||||||
}
|
}
|
||||||
catch ( MojoExecutionException e )
|
catch ( MojoExecutionException e )
|
||||||
{
|
{
|
||||||
|
@ -629,70 +619,6 @@ public class DefaultPluginManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
|
||||||
throws ArtifactNotFoundException, PluginConfigurationException, PluginManagerException, ArtifactResolutionException
|
|
||||||
{
|
|
||||||
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
|
||||||
PluginDescriptor descriptor = mojoDescriptor.getPluginDescriptor();
|
|
||||||
Xpp3Dom dom = project.getReportConfiguration( descriptor.getGroupId(), descriptor.getArtifactId(), mojoExecution.getExecutionId() );
|
|
||||||
if ( mojoExecution.getConfiguration() != null )
|
|
||||||
{
|
|
||||||
dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return (MavenReport) getConfiguredMojo( session, dom, project, true, mojoExecution );
|
|
||||||
}
|
|
||||||
|
|
||||||
public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
|
||||||
throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
|
|
||||||
PluginVersionNotFoundException
|
|
||||||
{
|
|
||||||
String version = reportPlugin.getVersion();
|
|
||||||
|
|
||||||
if ( version == null )
|
|
||||||
{
|
|
||||||
version = resolveReportPluginVersion( reportPlugin.getGroupId(), reportPlugin.getArtifactId(), project, session );
|
|
||||||
|
|
||||||
reportPlugin.setVersion( version );
|
|
||||||
}
|
|
||||||
|
|
||||||
Plugin plugin = new Plugin();
|
|
||||||
|
|
||||||
plugin.setGroupId( reportPlugin.getGroupId() );
|
|
||||||
plugin.setArtifactId( reportPlugin.getArtifactId() );
|
|
||||||
plugin.setVersion( version );
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
addPlugin( plugin, project, session );
|
|
||||||
}
|
|
||||||
catch ( ArtifactNotFoundException e )
|
|
||||||
{
|
|
||||||
String groupId = plugin.getGroupId();
|
|
||||||
|
|
||||||
String artifactId = plugin.getArtifactId();
|
|
||||||
|
|
||||||
String pluginVersion = plugin.getVersion();
|
|
||||||
|
|
||||||
if ( ( groupId == null ) || ( artifactId == null ) || ( pluginVersion == null ) )
|
|
||||||
{
|
|
||||||
throw new PluginNotFoundException( plugin, e );
|
|
||||||
}
|
|
||||||
else if ( groupId.equals( e.getGroupId() ) && artifactId.equals( e.getArtifactId() ) && pluginVersion.equals( e.getVersion() ) && "maven-plugin".equals( e.getType() ) )
|
|
||||||
{
|
|
||||||
throw new PluginNotFoundException( plugin, e );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PluginDescriptor pluginDescriptor = pluginCollector.getPluginDescriptor( plugin );
|
|
||||||
|
|
||||||
return pluginDescriptor;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Mojo getConfiguredMojo( MavenSession session, Xpp3Dom dom, MavenProject project, boolean report, MojoExecution mojoExecution )
|
private Mojo getConfiguredMojo( MavenSession session, Xpp3Dom dom, MavenProject project, boolean report, MojoExecution mojoExecution )
|
||||||
throws PluginConfigurationException, PluginManagerException
|
throws PluginConfigurationException, PluginManagerException
|
||||||
{
|
{
|
||||||
|
@ -735,12 +661,6 @@ public class DefaultPluginManager
|
||||||
logger.warn( "No luck." );
|
logger.warn( "No luck." );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( report && !( mojo instanceof MavenReport ) )
|
|
||||||
{
|
|
||||||
// TODO: the mojoDescriptor should actually capture this information so we don't get this far
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( mojo instanceof ContextEnabled )
|
if ( mojo instanceof ContextEnabled )
|
||||||
{
|
{
|
||||||
Map<String,Object> pluginContext = session.getPluginContext( pluginDescriptor, project );
|
Map<String,Object> pluginContext = session.getPluginContext( pluginDescriptor, project );
|
||||||
|
@ -1397,42 +1317,6 @@ public class DefaultPluginManager
|
||||||
plugin.setVersion( version );
|
plugin.setVersion( version );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String resolveReportPluginVersion( String groupId, String artifactId, MavenProject project, MavenSession session )
|
|
||||||
throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException
|
|
||||||
{
|
|
||||||
String version = null;
|
|
||||||
|
|
||||||
if ( project.getReportPlugins() != null )
|
|
||||||
{
|
|
||||||
for ( Iterator it = project.getReportPlugins().iterator(); it.hasNext() && ( version == null ); )
|
|
||||||
{
|
|
||||||
ReportPlugin plugin = (ReportPlugin) it.next();
|
|
||||||
|
|
||||||
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
|
|
||||||
{
|
|
||||||
version = plugin.getVersion();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// final pass...retrieve the version for RELEASE and also set that resolved version as the <useVersion/>
|
|
||||||
// in settings.xml.
|
|
||||||
if ( StringUtils.isEmpty( version ) || Artifact.RELEASE_VERSION.equals( version ) )
|
|
||||||
{
|
|
||||||
// 1. resolve the version to be used
|
|
||||||
version = resolveMetaVersion( groupId, artifactId, project, session.getLocalRepository(), Artifact.RELEASE_VERSION );
|
|
||||||
logger.debug( "Version from RELEASE metadata: " + version );
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we still haven't found a version, then fail early before we get into the update goop.
|
|
||||||
if ( StringUtils.isEmpty( version ) )
|
|
||||||
{
|
|
||||||
throw new PluginVersionNotFoundException( groupId, artifactId );
|
|
||||||
}
|
|
||||||
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String resolveMetaVersion( String groupId, String artifactId, MavenProject project, ArtifactRepository localRepository, String metaVersionId )
|
private String resolveMetaVersion( String groupId, String artifactId, MavenProject project, ArtifactRepository localRepository, String metaVersionId )
|
||||||
throws PluginVersionResolutionException, InvalidPluginException
|
throws PluginVersionResolutionException, InvalidPluginException
|
||||||
{
|
{
|
||||||
|
@ -1651,49 +1535,6 @@ public class DefaultPluginManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load the {@link PluginDescriptor} instance for the specified report plugin, using the project for
|
|
||||||
* the {@link ArtifactRepository} and other supplemental report/plugin information as necessary.
|
|
||||||
*/
|
|
||||||
public PluginDescriptor loadReportPlugin( ReportPlugin plugin, MavenProject project, MavenSession session )
|
|
||||||
throws PluginLoaderException
|
|
||||||
{
|
|
||||||
// TODO: Shouldn't we be injecting pluginManagement info here??
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return verifyReportPlugin( plugin, project, session );
|
|
||||||
}
|
|
||||||
catch ( ArtifactResolutionException e )
|
|
||||||
{
|
|
||||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( ArtifactNotFoundException e )
|
|
||||||
{
|
|
||||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( PluginNotFoundException e )
|
|
||||||
{
|
|
||||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( PluginVersionResolutionException e )
|
|
||||||
{
|
|
||||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( InvalidPluginException e )
|
|
||||||
{
|
|
||||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( PluginManagerException e )
|
|
||||||
{
|
|
||||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( PluginVersionNotFoundException e )
|
|
||||||
{
|
|
||||||
throw new PluginLoaderException( plugin, "Failed to load plugin. Reason: " + e.getMessage(), e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, MavenSession session )
|
public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, MavenSession session )
|
||||||
throws PluginLoaderException
|
throws PluginLoaderException
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,16 +15,11 @@ package org.apache.maven.plugin;
|
||||||
* the License.
|
* the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
import org.apache.maven.model.ReportPlugin;
|
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
|
||||||
import org.apache.maven.reporting.MavenReport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
|
@ -47,17 +42,4 @@ public interface PluginManager
|
||||||
//!!jvz The current project is contained in the session
|
//!!jvz The current project is contained in the session
|
||||||
void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
|
void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
|
||||||
throws MojoFailureException, PluginExecutionException, PluginConfigurationException;
|
throws MojoFailureException, PluginExecutionException, PluginConfigurationException;
|
||||||
|
|
||||||
//!!jvz
|
|
||||||
// Reporting
|
|
||||||
// As a function inside Maven is wrong. This needs to be entirely delegated to an external system. We need to provide an extension
|
|
||||||
// point for any tools that want to hook into the lifecycle but burning reporting into the core is extremely bad coupling. We need
|
|
||||||
// an aliasing mechanism for the POM as not to break backward compat. During 3.0 we can support this and at 3.1 with changes to the
|
|
||||||
// model we turf it.
|
|
||||||
|
|
||||||
MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
|
||||||
throws ArtifactNotFoundException, PluginConfigurationException, PluginManagerException, ArtifactResolutionException;
|
|
||||||
|
|
||||||
PluginDescriptor loadReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
|
||||||
throws PluginLoaderException;
|
|
||||||
}
|
}
|
|
@ -203,10 +203,6 @@ public class PluginParameterExpressionEvaluator
|
||||||
{
|
{
|
||||||
value = context.getSortedProjects();
|
value = context.getSortedProjects();
|
||||||
}
|
}
|
||||||
else if ( "reports".equals( expression ) )
|
|
||||||
{
|
|
||||||
value = context.getReports();
|
|
||||||
}
|
|
||||||
else if ("mojoExecution".equals(expression))
|
else if ("mojoExecution".equals(expression))
|
||||||
{
|
{
|
||||||
value = mojoExecution;
|
value = mojoExecution;
|
||||||
|
|
|
@ -43,6 +43,7 @@ under the License.
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.doxia</groupId>
|
<groupId>org.apache.maven.doxia</groupId>
|
||||||
<artifactId>doxia-sink-api</artifactId>
|
<artifactId>doxia-sink-api</artifactId>
|
||||||
|
<version>1.0-alpha-9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
14
pom.xml
14
pom.xml
|
@ -45,13 +45,6 @@ under the License.
|
||||||
<properties>
|
<properties>
|
||||||
<classWorldsVersion>1.3</classWorldsVersion>
|
<classWorldsVersion>1.3</classWorldsVersion>
|
||||||
<commonsCliVersion>1.0</commonsCliVersion>
|
<commonsCliVersion>1.0</commonsCliVersion>
|
||||||
<!--
|
|
||||||
|
|
||||||
Do not update this, Doxia will be decoupled completely from 3.x and someone can
|
|
||||||
create a rendering engine for it if they like when the release stabilizes. JVZ
|
|
||||||
|
|
||||||
-->
|
|
||||||
<doxiaVersion>1.0-alpha-9</doxiaVersion>
|
|
||||||
<easyMockVersion>1.2_Java1.3</easyMockVersion>
|
<easyMockVersion>1.2_Java1.3</easyMockVersion>
|
||||||
<junitVersion>3.8.1</junitVersion>
|
<junitVersion>3.8.1</junitVersion>
|
||||||
<plexusVersion>1.0-beta-3.0.6</plexusVersion>
|
<plexusVersion>1.0-beta-3.0.6</plexusVersion>
|
||||||
|
@ -240,7 +233,6 @@ under the License.
|
||||||
<module>maven-model</module>
|
<module>maven-model</module>
|
||||||
<module>maven-plugin-api</module>
|
<module>maven-plugin-api</module>
|
||||||
<module>maven-project</module>
|
<module>maven-project</module>
|
||||||
<module>maven-reporting-api</module>
|
|
||||||
<module>maven-project-builder</module>
|
<module>maven-project-builder</module>
|
||||||
<module>maven-mercury</module>
|
<module>maven-mercury</module>
|
||||||
<module>maven-embedder</module>
|
<module>maven-embedder</module>
|
||||||
|
@ -412,12 +404,6 @@ under the License.
|
||||||
<artifactId>wagon-ssh-external</artifactId>
|
<artifactId>wagon-ssh-external</artifactId>
|
||||||
<version>${wagonVersion}</version>
|
<version>${wagonVersion}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Doxia -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven.doxia</groupId>
|
|
||||||
<artifactId>doxia-sink-api</artifactId>
|
|
||||||
<version>${doxiaVersion}</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Maven Shared -->
|
<!-- Maven Shared -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.sonatype.spice</groupId>
|
<groupId>org.sonatype.spice</groupId>
|
||||||
|
|
Loading…
Reference in New Issue