Package org.apache.maven.reporting.exec
Class DefaultMavenReportExecutor
- java.lang.Object
-
- org.apache.maven.reporting.exec.DefaultMavenReportExecutor
-
- All Implemented Interfaces:
MavenReportExecutor
@Component(role=MavenReportExecutor.class) public class DefaultMavenReportExecutor extends Object implements MavenReportExecutor
This component will build some
MavenReportExecution
fromMavenReportExecutorRequest
. If aMavenReport
needs to fork a lifecycle, this fork is executed here. It will ask the core to get some informations in order to correctly setupMavenReport
.Note if no version is defined in the report plugin, the version will be searched with
resolvePluginVersion(...)
method:- use the one defined in the reportPlugin configuration,
- search similar (same groupId and artifactId) plugin in the build/plugins section of the pom,
- search similar (same groupId and artifactId) plugin in the build/pluginManagement section of the pom,
- ask
PluginVersionResolver
to get a fallback version (display a warning as it's not a recommended use).
Following steps are done:
- get
PluginDescriptor
from theMavenPluginManager
(throughMavenPluginManagerHelper.getPluginDescriptor(...)
to protect from core API change) - setup a
ClassLoader
, with the Site plugin classloader as parent for the report execution.
Notice that some classes are imported from the current Site plugin ClassRealm: seeIMPORTS
. Corresponding artifacts are excluded from the artifact resolution:doxia-site-renderer
,doxia-sink-api
andmaven-reporting-api
.
Work is done usingMavenPluginManager
(throughMavenPluginManagerHelper.setupPluginRealm(...)
to protect from core API change) - setup the mojo using
MavenPluginManager.getConfiguredMojo(...)
- verify with
LifecycleExecutor.calculateForkedExecutions(...)
if any forked execution is needed: if yes, execute the forked execution here
- Author:
- Olivier Lamy
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.maven.lifecycle.LifecycleExecutor
lifecycleExecutor
protected org.apache.maven.plugin.MavenPluginManager
mavenPluginManager
protected MavenPluginManagerHelper
mavenPluginManagerHelper
protected org.apache.maven.plugin.version.PluginVersionResolver
pluginVersionResolver
-
Constructor Summary
Constructors Constructor Description DefaultMavenReportExecutor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MavenReportExecution>
buildMavenReports(MavenReportExecutorRequest mavenReportExecutorRequest)
Build theMavenReport
s, with associated forked executions if necessary.protected List<MavenReportExecution>
buildReportPlugin(MavenReportExecutorRequest mavenReportExecutorRequest, ReportPlugin reportPlugin)
protected String
resolvePluginVersion(ReportPlugin reportPlugin, MavenReportExecutorRequest mavenReportExecutorRequest)
Resolve report plugin version.
-
-
-
Field Detail
-
mavenPluginManager
@Requirement protected org.apache.maven.plugin.MavenPluginManager mavenPluginManager
-
mavenPluginManagerHelper
@Requirement protected MavenPluginManagerHelper mavenPluginManagerHelper
-
lifecycleExecutor
@Requirement protected org.apache.maven.lifecycle.LifecycleExecutor lifecycleExecutor
-
pluginVersionResolver
@Requirement protected org.apache.maven.plugin.version.PluginVersionResolver pluginVersionResolver
-
-
Method Detail
-
buildMavenReports
public List<MavenReportExecution> buildMavenReports(MavenReportExecutorRequest mavenReportExecutorRequest) throws org.apache.maven.plugin.MojoExecutionException
Description copied from interface:MavenReportExecutor
Build theMavenReport
s, with associated forked executions if necessary.- Specified by:
buildMavenReports
in interfaceMavenReportExecutor
- Returns:
- a list or prepared Maven report executions
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
buildReportPlugin
protected List<MavenReportExecution> buildReportPlugin(MavenReportExecutorRequest mavenReportExecutorRequest, ReportPlugin reportPlugin) throws Exception
- Throws:
Exception
-
resolvePluginVersion
protected String resolvePluginVersion(ReportPlugin reportPlugin, MavenReportExecutorRequest mavenReportExecutorRequest) throws org.apache.maven.plugin.version.PluginVersionResolutionException
Resolve report plugin version. Steps to find a plugin version stop after each step if a nonnull
value has been found:- use the one defined in the reportPlugin configuration,
- search similar (same groupId and artifactId) mojo in the build/plugins section of the pom,
- search similar (same groupId and artifactId) mojo in the build/pluginManagement section of the pom,
- ask
PluginVersionResolver
to get a fallback version and display a warning as it's not a recommended use.
- Parameters:
reportPlugin
- the report plugin to resolve the versionmavenReportExecutorRequest
- the current report execution context- Returns:
- the report plugin version
- Throws:
org.apache.maven.plugin.version.PluginVersionResolutionException
-
-