diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java index 962a5c69f0..abae02bb21 100644 --- a/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java +++ b/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java @@ -52,8 +52,6 @@ public class MavenSession private MavenExecutionRequest request; private MavenProject currentProject; - - private Map reports = new LinkedHashMap(); // Used by the embedder to verifyPlugin public MavenSession( PlexusContainer container, MavenExecutionRequest request ) @@ -150,47 +148,6 @@ public class MavenSession 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() { return request.getProjectBuildingConfiguration(); 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 8dbc1119f7..26a1f4b8ce 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 @@ -55,7 +55,6 @@ import org.apache.maven.model.Dependency; import org.apache.maven.model.Model; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginExecution; -import org.apache.maven.model.ReportPlugin; import org.apache.maven.monitor.logging.DefaultLog; import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.Parameter; @@ -583,15 +582,6 @@ public class DefaultPluginManager { 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 ) { @@ -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 ) throws PluginConfigurationException, PluginManagerException { @@ -735,12 +661,6 @@ public class DefaultPluginManager 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 ) { Map pluginContext = session.getPluginContext( pluginDescriptor, project ); @@ -1397,42 +1317,6 @@ public class DefaultPluginManager 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 - // 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 ) throws PluginVersionResolutionException, InvalidPluginException { @@ -1650,49 +1534,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 ) throws PluginLoaderException diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java index ddfd8edb00..f3d200b242 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java @@ -15,16 +15,11 @@ package org.apache.maven.plugin; * 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.model.Plugin; -import org.apache.maven.model.ReportPlugin; import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; -import org.apache.maven.reporting.MavenReport; /** * @author Jason van Zyl @@ -46,18 +41,5 @@ public interface PluginManager //!!jvz The current project is contained in the session void executeMojo( MavenProject project, MojoExecution execution, MavenSession session ) - 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; + throws MojoFailureException, PluginExecutionException, PluginConfigurationException; } \ No newline at end of file diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java index f5f9ce5f29..197b70a102 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java @@ -203,10 +203,6 @@ public class PluginParameterExpressionEvaluator { value = context.getSortedProjects(); } - else if ( "reports".equals( expression ) ) - { - value = context.getReports(); - } else if ("mojoExecution".equals(expression)) { value = mojoExecution; diff --git a/maven-reporting-api/pom.xml b/maven-reporting-api/pom.xml index c672717306..2aee1381ff 100644 --- a/maven-reporting-api/pom.xml +++ b/maven-reporting-api/pom.xml @@ -43,6 +43,7 @@ under the License. org.apache.maven.doxia doxia-sink-api + 1.0-alpha-9 diff --git a/pom.xml b/pom.xml index 3d22db8800..5fb173fd1a 100644 --- a/pom.xml +++ b/pom.xml @@ -45,13 +45,6 @@ under the License. 1.3 1.0 - - 1.0-alpha-9 1.2_Java1.3 3.8.1 1.0-beta-3.0.6 @@ -240,7 +233,6 @@ under the License. maven-model maven-plugin-api maven-project - maven-reporting-api maven-project-builder maven-mercury maven-embedder @@ -412,12 +404,6 @@ under the License. wagon-ssh-external ${wagonVersion} - - - org.apache.maven.doxia - doxia-sink-api - ${doxiaVersion} - org.sonatype.spice