mirror of https://github.com/apache/maven.git
PR: MNG-629
preparing for executing the lifecycle by passing reports into the site plugin, rather than extracting them from the plugin manager git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290634 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
881aa8b860
commit
8858d8f85c
|
@ -31,6 +31,8 @@ import org.apache.maven.model.Goal;
|
|||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.apache.maven.model.PluginManagement;
|
||||
import org.apache.maven.model.ReportPlugin;
|
||||
import org.apache.maven.model.ReportSet;
|
||||
import org.apache.maven.monitor.event.EventDispatcher;
|
||||
import org.apache.maven.monitor.event.MavenEvents;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
|
@ -47,6 +49,7 @@ import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
|||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.injection.ModelDefaultsInjector;
|
||||
import org.apache.maven.reactor.ReactorException;
|
||||
import org.apache.maven.reporting.MavenReport;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.codehaus.plexus.PlexusContainerException;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
|
@ -474,6 +477,13 @@ public class DefaultLifecycleExecutor
|
|||
forkLifecycle( mojoDescriptor, session, project );
|
||||
}
|
||||
|
||||
if ( mojoDescriptor.isRequiresReports() )
|
||||
{
|
||||
List reports = getReports( project, mojoExecution, session );
|
||||
|
||||
mojoExecution.setReports( reports );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
pluginManager.executeMojo( project, mojoExecution, session );
|
||||
|
@ -485,6 +495,91 @@ public class DefaultLifecycleExecutor
|
|||
}
|
||||
}
|
||||
|
||||
private List getReports( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
||||
throws ArtifactResolutionException, LifecycleExecutionException
|
||||
{
|
||||
List reportPlugins = project.getReportPlugins();
|
||||
|
||||
if ( project.getModel().getReports() != null )
|
||||
{
|
||||
getLogger().error(
|
||||
"DEPRECATED: Plugin contains a <reports/> section: this is IGNORED - please use <reporting/> instead." );
|
||||
}
|
||||
|
||||
List reports = new ArrayList();
|
||||
if ( reportPlugins != null )
|
||||
{
|
||||
for ( Iterator it = reportPlugins.iterator(); it.hasNext(); )
|
||||
{
|
||||
ReportPlugin reportPlugin = (ReportPlugin) it.next();
|
||||
|
||||
List reportSets = reportPlugin.getReportSets();
|
||||
|
||||
try
|
||||
{
|
||||
if ( reportSets == null || reportSets.isEmpty() )
|
||||
{
|
||||
reports.addAll( getReports( reportPlugin, null, project, session, mojoExecution ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( Iterator j = reportSets.iterator(); j.hasNext(); )
|
||||
{
|
||||
ReportSet reportSet = (ReportSet) j.next();
|
||||
|
||||
reports.addAll( getReports( reportPlugin, reportSet, project, session, mojoExecution ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( PluginManagerException e )
|
||||
{
|
||||
throw new LifecycleExecutionException( "Error getting reports", e );
|
||||
}
|
||||
catch ( PluginVersionResolutionException e )
|
||||
{
|
||||
throw new LifecycleExecutionException( "Error getting reports", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
return reports;
|
||||
}
|
||||
|
||||
private List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session,
|
||||
MojoExecution mojoExecution )
|
||||
throws PluginManagerException, PluginVersionResolutionException, ArtifactResolutionException
|
||||
{
|
||||
PluginDescriptor pluginDescriptor = pluginManager.verifyReportPlugin( reportPlugin, project, session );
|
||||
|
||||
List reports = new ArrayList();
|
||||
for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
|
||||
{
|
||||
MojoDescriptor mojoDescriptor = (MojoDescriptor) i.next();
|
||||
|
||||
// TODO: check ID is correct for reports
|
||||
// if the POM configured no reports, give all from plugin
|
||||
if ( reportSet == null || reportSet.getReports().contains( mojoDescriptor.getGoal() ) )
|
||||
{
|
||||
String id = null;
|
||||
if ( reportSet != null )
|
||||
{
|
||||
id = reportSet.getId();
|
||||
}
|
||||
|
||||
MojoExecution reportExecution = new MojoExecution( mojoDescriptor, id );
|
||||
|
||||
MavenReport reportMojo = pluginManager.getReport( project, reportExecution, session );
|
||||
|
||||
// Comes back null if it was a plugin, not a report - these are mojos in the reporting plugins that are not reports
|
||||
if ( reportMojo != null )
|
||||
{
|
||||
reports.add( reportMojo );
|
||||
mojoExecution.addMojoExecution( reportExecution );
|
||||
}
|
||||
}
|
||||
}
|
||||
return reports;
|
||||
}
|
||||
|
||||
private void forkLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project )
|
||||
throws LifecycleExecutionException, MojoExecutionException, ArtifactResolutionException
|
||||
{
|
||||
|
|
|
@ -17,7 +17,6 @@ package org.apache.maven.plugin;
|
|||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.ArtifactUtils;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||
|
@ -36,7 +35,6 @@ import org.apache.maven.execution.MavenSession;
|
|||
import org.apache.maven.execution.RuntimeInformation;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.ReportPlugin;
|
||||
import org.apache.maven.model.ReportSet;
|
||||
import org.apache.maven.monitor.event.EventDispatcher;
|
||||
import org.apache.maven.monitor.event.MavenEvents;
|
||||
import org.apache.maven.monitor.logging.DefaultLog;
|
||||
|
@ -160,6 +158,13 @@ public class DefaultPluginManager
|
|||
plugin.setVersion( version );
|
||||
}
|
||||
|
||||
return verifyVersionedPlugin( plugin, project, localRepository );
|
||||
}
|
||||
|
||||
private PluginDescriptor verifyVersionedPlugin( Plugin plugin, MavenProject project,
|
||||
ArtifactRepository localRepository )
|
||||
throws PluginVersionResolutionException, PluginManagerException, ArtifactResolutionException
|
||||
{
|
||||
// TODO: this might result in an artifact "RELEASE" being resolved continuously
|
||||
// FIXME: need to find out how a plugin gets marked as 'installed'
|
||||
// and no ChildContainer exists. The check for that below fixes
|
||||
|
@ -327,7 +332,7 @@ public class DefaultPluginManager
|
|||
dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() );
|
||||
}
|
||||
|
||||
plugin = getConfiguredMojo( mojoDescriptor, session, dom, project, false );
|
||||
plugin = getConfiguredMojo( session, dom, project, false, mojoExecution );
|
||||
}
|
||||
catch ( PluginConfigurationException e )
|
||||
{
|
||||
|
@ -390,69 +395,55 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
public List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session )
|
||||
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException,
|
||||
ArtifactResolutionException
|
||||
public MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
||||
throws PluginManagerException
|
||||
{
|
||||
Plugin forLookup = new Plugin();
|
||||
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() );
|
||||
}
|
||||
|
||||
String groupId = reportPlugin.getGroupId();
|
||||
String artifactId = reportPlugin.getArtifactId();
|
||||
|
||||
forLookup.setGroupId( groupId );
|
||||
forLookup.setArtifactId( artifactId );
|
||||
MavenReport reportMojo;
|
||||
try
|
||||
{
|
||||
reportMojo = (MavenReport) getConfiguredMojo( session, dom, project, true, mojoExecution );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
throw new PluginManagerException( "Error looking up report: ", e );
|
||||
}
|
||||
catch ( PluginConfigurationException e )
|
||||
{
|
||||
throw new PluginManagerException( "Error configuring report: ", e );
|
||||
}
|
||||
return reportMojo;
|
||||
}
|
||||
|
||||
public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
||||
throws PluginVersionResolutionException, ArtifactResolutionException, PluginManagerException
|
||||
{
|
||||
String version = reportPlugin.getVersion();
|
||||
|
||||
Artifact existingPluginArtifact = (Artifact) project.getReportArtifactMap().get( reportPlugin.getKey() );
|
||||
|
||||
if ( existingPluginArtifact == null ||
|
||||
!reportPlugin.getKey().equals( ArtifactUtils.versionlessKey( existingPluginArtifact ) ) || version == null )
|
||||
if ( version == null )
|
||||
{
|
||||
version = pluginVersionManager.resolvePluginVersion( groupId, artifactId, project, session.getSettings(),
|
||||
session.getLocalRepository(), true );
|
||||
version = pluginVersionManager.resolveReportPluginVersion( reportPlugin.getGroupId(),
|
||||
reportPlugin.getArtifactId(), project,
|
||||
session.getSettings(),
|
||||
session.getLocalRepository() );
|
||||
reportPlugin.setVersion( version );
|
||||
}
|
||||
|
||||
Plugin forLookup = new Plugin();
|
||||
|
||||
forLookup.setGroupId( reportPlugin.getGroupId() );
|
||||
forLookup.setArtifactId( reportPlugin.getArtifactId() );
|
||||
forLookup.setVersion( version );
|
||||
|
||||
PluginDescriptor pluginDescriptor = verifyPlugin( forLookup, project, session
|
||||
.getSettings(), session.getLocalRepository() );
|
||||
|
||||
List reports = new ArrayList();
|
||||
for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
|
||||
{
|
||||
MojoDescriptor mojoDescriptor = (MojoDescriptor) i.next();
|
||||
|
||||
// TODO: check ID is correct for reports
|
||||
// if the POM configured no reports, give all from plugin
|
||||
if ( reportSet == null || reportSet.getReports().contains( mojoDescriptor.getGoal() ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
String id = null;
|
||||
if ( reportSet != null )
|
||||
{
|
||||
id = reportSet.getId();
|
||||
}
|
||||
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, id );
|
||||
|
||||
String executionId = mojoExecution.getExecutionId();
|
||||
Xpp3Dom dom = project.getReportConfiguration( reportPlugin.getGroupId(),
|
||||
reportPlugin.getArtifactId(), executionId );
|
||||
|
||||
Mojo reportMojo = getConfiguredMojo( mojoDescriptor, session, dom, project, true );
|
||||
if ( reportMojo != null )
|
||||
{
|
||||
reports.add( reportMojo );
|
||||
}
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
throw new PluginManagerException( "Error looking up plugin: ", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
return reports;
|
||||
return verifyVersionedPlugin( forLookup, project, session.getLocalRepository() );
|
||||
}
|
||||
|
||||
private PlexusContainer getPluginContainer( PluginDescriptor pluginDescriptor )
|
||||
|
@ -469,10 +460,12 @@ public class DefaultPluginManager
|
|||
return pluginContainer;
|
||||
}
|
||||
|
||||
private Mojo getConfiguredMojo( MojoDescriptor mojoDescriptor, MavenSession session, Xpp3Dom dom,
|
||||
MavenProject project, boolean report )
|
||||
private Mojo getConfiguredMojo( MavenSession session, Xpp3Dom dom, MavenProject project, boolean report,
|
||||
MojoExecution mojoExecution )
|
||||
throws ComponentLookupException, PluginConfigurationException, PluginManagerException
|
||||
{
|
||||
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
||||
|
||||
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
|
||||
|
||||
PlexusContainer pluginContainer = getPluginContainer( pluginDescriptor );
|
||||
|
@ -511,7 +504,7 @@ public class DefaultPluginManager
|
|||
// PlexusConfiguration mergedConfiguration = mergeConfiguration( pomConfiguration,
|
||||
// mojoDescriptor.getConfiguration() );
|
||||
|
||||
ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, mojoDescriptor,
|
||||
ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, mojoExecution,
|
||||
pathTranslator, getLogger(),
|
||||
project );
|
||||
|
||||
|
@ -1019,8 +1012,8 @@ public class DefaultPluginManager
|
|||
configurator = (ComponentConfigurator) pluginContainer.lookup( ComponentConfigurator.ROLE );
|
||||
}
|
||||
|
||||
configurator.configureComponent( plugin, configuration, expressionEvaluator, pluginContainer
|
||||
.getContainerRealm() );
|
||||
configurator.configureComponent( plugin, configuration, expressionEvaluator,
|
||||
pluginContainer.getContainerRealm() );
|
||||
}
|
||||
catch ( ComponentConfigurationException e )
|
||||
{
|
||||
|
|
|
@ -19,6 +19,9 @@ package org.apache.maven.plugin;
|
|||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Describes a single mojo invocation.
|
||||
*
|
||||
|
@ -33,6 +36,10 @@ public class MojoExecution
|
|||
|
||||
private final Xpp3Dom configuration;
|
||||
|
||||
private List forkedExecutions = new ArrayList();
|
||||
|
||||
private List reports;
|
||||
|
||||
public MojoExecution( MojoDescriptor mojoDescriptor )
|
||||
{
|
||||
this.mojoDescriptor = mojoDescriptor;
|
||||
|
@ -68,4 +75,19 @@ public class MojoExecution
|
|||
{
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public void addMojoExecution( MojoExecution execution )
|
||||
{
|
||||
forkedExecutions.add( execution );
|
||||
}
|
||||
|
||||
public void setReports( List reports )
|
||||
{
|
||||
this.reports = reports;
|
||||
}
|
||||
|
||||
public List getReports()
|
||||
{
|
||||
return reports;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,16 +19,15 @@ package org.apache.maven.plugin;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
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.PluginDescriptor;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.MavenReport;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.ReportPlugin;
|
||||
import org.apache.maven.model.ReportSet;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -42,6 +41,9 @@ public interface PluginManager
|
|||
void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
|
||||
throws MojoExecutionException, PluginManagerException, ArtifactResolutionException;
|
||||
|
||||
MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
||||
throws PluginManagerException;
|
||||
|
||||
PluginDescriptor getPluginDescriptorForPrefix( String prefix )
|
||||
throws PluginManagerException;
|
||||
|
||||
|
@ -52,9 +54,8 @@ public interface PluginManager
|
|||
ArtifactRepository localRepository )
|
||||
throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException;
|
||||
|
||||
List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session )
|
||||
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException,
|
||||
ArtifactResolutionException;
|
||||
PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
|
||||
throws PluginVersionResolutionException, ArtifactResolutionException, PluginManagerException;
|
||||
|
||||
Object getPluginComponent( Plugin plugin, String role, String roleHint )
|
||||
throws ComponentLookupException, PluginManagerException;
|
||||
|
|
|
@ -62,15 +62,15 @@ public class PluginParameterExpressionEvaluator
|
|||
|
||||
private final Logger logger;
|
||||
|
||||
private final MojoDescriptor mojoDescriptor;
|
||||
private final MojoExecution mojoExecution;
|
||||
|
||||
private final MavenProject project;
|
||||
|
||||
public PluginParameterExpressionEvaluator( MavenSession context, MojoDescriptor mojoDescriptor,
|
||||
PathTranslator pathTranslator, Logger logger, MavenProject project )
|
||||
public PluginParameterExpressionEvaluator( MavenSession context, MojoExecution mojoExecution,
|
||||
PathTranslator pathTranslator, Logger logger, MavenProject project )
|
||||
{
|
||||
this.context = context;
|
||||
this.mojoDescriptor = mojoDescriptor;
|
||||
this.mojoExecution = mojoExecution;
|
||||
this.pathTranslator = pathTranslator;
|
||||
this.logger = logger;
|
||||
this.project = project;
|
||||
|
@ -106,16 +106,18 @@ public class PluginParameterExpressionEvaluator
|
|||
return expression;
|
||||
}
|
||||
|
||||
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
||||
if ( BANNED_EXPRESSIONS.containsKey( expression ) )
|
||||
{
|
||||
throw new ExpressionEvaluationException( "The parameter expression: \'" + expression
|
||||
+ "\' used in mojo: \'" + mojoDescriptor.getGoal() + "\' is banned. Use \'"
|
||||
+ BANNED_EXPRESSIONS.get( expression ) + "\' instead." );
|
||||
throw new ExpressionEvaluationException( "The parameter expression: \'" + expression +
|
||||
"\' used in mojo: \'" + mojoDescriptor.getGoal() + "\' is banned. Use \'" +
|
||||
BANNED_EXPRESSIONS.get( expression ) + "\' instead." );
|
||||
}
|
||||
else if ( DEPRECATED_EXPRESSIONS.containsKey( expression ) )
|
||||
{
|
||||
logger.warn( "The parameter expression: \'" + expression + "\' used in mojo: \'" + mojoDescriptor.getGoal()
|
||||
+ "\' has been deprecated. Use \'" + DEPRECATED_EXPRESSIONS.get( expression ) + "\' instead." );
|
||||
logger.warn( "The parameter expression: \'" + expression + "\' used in mojo: \'" +
|
||||
mojoDescriptor.getGoal() + "\' has been deprecated. Use \'" + DEPRECATED_EXPRESSIONS.get( expression ) +
|
||||
"\' instead." );
|
||||
}
|
||||
|
||||
if ( "localRepository".equals( expression ) )
|
||||
|
@ -130,6 +132,10 @@ public class PluginParameterExpressionEvaluator
|
|||
{
|
||||
value = context.getSortedProjects();
|
||||
}
|
||||
else if ( "reports".equals( expression ) )
|
||||
{
|
||||
value = mojoExecution.getReports();
|
||||
}
|
||||
else if ( "project".equals( expression ) )
|
||||
{
|
||||
value = project;
|
||||
|
|
|
@ -80,8 +80,15 @@ public class DefaultPluginVersionManager
|
|||
return resolvePluginVersion( groupId, artifactId, project, settings, localRepository, false );
|
||||
}
|
||||
|
||||
public String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
|
||||
ArtifactRepository localRepository, boolean resolveAsReportPlugin )
|
||||
public String resolveReportPluginVersion( String groupId, String artifactId, MavenProject project,
|
||||
Settings settings, ArtifactRepository localRepository )
|
||||
throws PluginVersionResolutionException
|
||||
{
|
||||
return resolvePluginVersion( groupId, artifactId, project, settings, localRepository, true );
|
||||
}
|
||||
|
||||
private String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
|
||||
ArtifactRepository localRepository, boolean resolveAsReportPlugin )
|
||||
throws PluginVersionResolutionException
|
||||
{
|
||||
// first pass...if the plugin is specified in the pom, try to retrieve the version from there.
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package org.apache.maven.plugin.version;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.settings.Settings;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -20,15 +16,20 @@ import org.apache.maven.settings.Settings;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.settings.Settings;
|
||||
|
||||
public interface PluginVersionManager
|
||||
{
|
||||
|
||||
String ROLE = PluginVersionManager.class.getName();
|
||||
|
||||
String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings, ArtifactRepository localRepository )
|
||||
String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
|
||||
ArtifactRepository localRepository )
|
||||
throws PluginVersionResolutionException;
|
||||
|
||||
String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings, ArtifactRepository localRepository, boolean resolveAsReportPlugin )
|
||||
String resolveReportPluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
|
||||
ArtifactRepository localRepository )
|
||||
throws PluginVersionResolutionException;
|
||||
|
||||
}
|
||||
|
|
|
@ -69,8 +69,8 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
assertEquals( expected, actual );
|
||||
}
|
||||
|
||||
private static MavenSession createSession( PlexusContainer container,
|
||||
ArtifactRepository repo ) throws CycleDetectedException
|
||||
private static MavenSession createSession( PlexusContainer container, ArtifactRepository repo )
|
||||
throws CycleDetectedException
|
||||
{
|
||||
return new MavenSession( container, new Settings(), repo, new DefaultEventDispatcher(),
|
||||
new ReactorManager( Collections.EMPTY_LIST ), Collections.EMPTY_LIST, "." );
|
||||
|
@ -146,7 +146,9 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
mojo.setPluginDescriptor( pluginDescriptor );
|
||||
mojo.setGoal( "goal" );
|
||||
|
||||
return (ExpressionEvaluator) new PluginParameterExpressionEvaluator( session, mojo, null,
|
||||
MojoExecution mojoExecution = new MojoExecution( mojo );
|
||||
|
||||
return (ExpressionEvaluator) new PluginParameterExpressionEvaluator( session, mojoExecution, null,
|
||||
container.getLogger(), project );
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ public class MojoDescriptor
|
|||
|
||||
private boolean directInvocationOnly = false;
|
||||
|
||||
private boolean requiresReports = false;
|
||||
|
||||
public MojoDescriptor()
|
||||
{
|
||||
setInstantiationStrategy( DEFAULT_INSTANTIATION_STRATEGY );
|
||||
|
@ -132,9 +134,9 @@ public class MojoDescriptor
|
|||
{
|
||||
if ( parameters != null && parameters.contains( parameter ) )
|
||||
{
|
||||
throw new DuplicateParameterException( parameter.getName()
|
||||
+ " has been declared multiple times in mojo with goal: " + getGoal() + " (implementation: "
|
||||
+ getImplementation() + ")" );
|
||||
throw new DuplicateParameterException( parameter.getName() +
|
||||
" has been declared multiple times in mojo with goal: " + getGoal() + " (implementation: " +
|
||||
getImplementation() + ")" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -413,4 +415,14 @@ public class MojoDescriptor
|
|||
{
|
||||
this.directInvocationOnly = directInvocationOnly;
|
||||
}
|
||||
|
||||
public boolean isRequiresReports()
|
||||
{
|
||||
return requiresReports;
|
||||
}
|
||||
|
||||
public void setRequiresReports( boolean requiresReports )
|
||||
{
|
||||
this.requiresReports = requiresReports;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class PluginDescriptorBuilder
|
|||
|
||||
String isolatedRealm = c.getChild( "isolatedRealm" ).getValue();
|
||||
|
||||
if( isolatedRealm != null )
|
||||
if ( isolatedRealm != null )
|
||||
{
|
||||
pluginDescriptor.setIsolatedRealm( Boolean.valueOf( isolatedRealm ).booleanValue() );
|
||||
}
|
||||
|
@ -174,6 +174,13 @@ public class PluginDescriptorBuilder
|
|||
mojo.setProjectRequired( Boolean.valueOf( requiresProject ).booleanValue() );
|
||||
}
|
||||
|
||||
String requiresReports = c.getChild( "requiresReports" ).getValue();
|
||||
|
||||
if ( requiresReports != null )
|
||||
{
|
||||
mojo.setRequiresReports( Boolean.valueOf( requiresReports ).booleanValue() );
|
||||
}
|
||||
|
||||
String aggregator = c.getChild( "aggregator" ).getValue();
|
||||
|
||||
if ( aggregator != null )
|
||||
|
|
|
@ -139,6 +139,12 @@ public class PluginDescriptorGenerator
|
|||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
element( w, "requiresReports", "" + mojoDescriptor.isRequiresReports() );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
element( w, "aggregator", "" + mojoDescriptor.isAggregator() );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
|
@ -140,6 +140,10 @@ extract( file, mojoDescriptor )
|
|||
this.parameter = createParameter( text, method );
|
||||
if ( parameter != null )
|
||||
{
|
||||
if ( "${reports}".equals( parameter.getExpression() ) )
|
||||
{
|
||||
mojoDescriptor.setRequiresReports( true );
|
||||
}
|
||||
mojoDescriptor.addParameter( parameter );
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
|||
import org.apache.maven.plugin.descriptor.Requirement;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -68,8 +68,7 @@ public class JavaMojoDescriptorExtractor
|
|||
* Would say there is a getProject() method and a setProject(Project) method. Here the field
|
||||
* name would not be the basis for the parameter's name. This mode of operation will allow the
|
||||
* mojos to be usable as beans and will be the promoted form of use.
|
||||
*
|
||||
**/
|
||||
*/
|
||||
public static final String PARAMETER_PROPERTY = "property";
|
||||
|
||||
public static final String REQUIRED = "required";
|
||||
|
@ -90,6 +89,8 @@ public class JavaMojoDescriptorExtractor
|
|||
|
||||
public static final String GOAL_REQUIRES_PROJECT = "requiresProject";
|
||||
|
||||
public static final String GOAL_REQUIRES_REPORTS = "requiresReports";
|
||||
|
||||
public static final String GOAL_IS_AGGREGATOR = "aggregator";
|
||||
|
||||
public static final String GOAL_REQUIRES_ONLINE = "requiresOnline";
|
||||
|
@ -414,6 +415,11 @@ public class JavaMojoDescriptorExtractor
|
|||
|
||||
pd.setExpression( parameter.getNamedParameter( PARAMETER_EXPRESSION ) );
|
||||
|
||||
if ( "${reports}".equals( pd.getExpression() ) )
|
||||
{
|
||||
mojoDescriptor.setRequiresReports( true );
|
||||
}
|
||||
|
||||
pd.setDefaultValue( parameter.getNamedParameter( PARAMETER_DEFAULT_VALUE ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -11,51 +11,31 @@
|
|||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
<inceptionYear>2001</inceptionYear>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-repository-metadata</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-api</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-java</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-beanshell</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-marmalade</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
<packaging>maven-plugin</packaging>
|
||||
<name>Maven Site plugin</name>
|
||||
<version>2.0-beta-2-SNAPSHOT</version>
|
||||
<prerequisites>
|
||||
<maven>2.0-beta-2-SNAPSHOT</maven>
|
||||
</prerequisites>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>vsiveton</id>
|
||||
|
@ -22,21 +25,11 @@
|
|||
</developer>
|
||||
</developers>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-settings</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-site-renderer</artifactId>
|
||||
<version>1.0-alpha-2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
|
@ -46,6 +39,11 @@
|
|||
<artifactId>maven-reporting-api</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
|
|
|
@ -16,16 +16,8 @@ package org.apache.maven.doxia;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.model.ReportPlugin;
|
||||
import org.apache.maven.model.ReportSet;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.PluginConfigurationException;
|
||||
import org.apache.maven.plugin.PluginManager;
|
||||
import org.apache.maven.plugin.PluginManagerException;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.MavenReport;
|
||||
import org.apache.maven.reporting.MavenReportException;
|
||||
|
@ -106,19 +98,19 @@ public class DoxiaMojo
|
|||
* @parameter expression="${basedir}/src/site"
|
||||
* @required
|
||||
*/
|
||||
private String siteDirectory;
|
||||
private File siteDirectory;
|
||||
|
||||
/**
|
||||
* @parameter alias="workingDirectory" expression="${project.build.directory}/generated-site"
|
||||
* @required
|
||||
*/
|
||||
private String generatedSiteDirectory;
|
||||
private File generatedSiteDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}/site"
|
||||
* @required
|
||||
*/
|
||||
private String outputDirectory;
|
||||
private File outputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${basedir}/src/site/resources"
|
||||
|
@ -127,17 +119,17 @@ public class DoxiaMojo
|
|||
private File resourcesDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${templateDirectory}
|
||||
* @parameter expression="${templateDirectory}"
|
||||
*/
|
||||
private String templateDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${template}
|
||||
* @parameter expression="${template}"
|
||||
*/
|
||||
private String template = DEFAULT_TEMPLATE;
|
||||
|
||||
/**
|
||||
* @parameter expression="${attributes}
|
||||
* @parameter expression="${attributes}"
|
||||
*/
|
||||
private Map attributes;
|
||||
|
||||
|
@ -145,7 +137,7 @@ public class DoxiaMojo
|
|||
* A comma separated list of locales supported by Maven. The first valid token will be the default Locale
|
||||
* for this instance of the Java Virtual Machine.
|
||||
*
|
||||
* @parameter expression="${locales}
|
||||
* @parameter expression="${locales}"
|
||||
*/
|
||||
private String locales;
|
||||
|
||||
|
@ -183,18 +175,11 @@ public class DoxiaMojo
|
|||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.apache.maven.plugin.PluginManager}"
|
||||
* @parameter expression="${reports}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private PluginManager pluginManager;
|
||||
|
||||
/**
|
||||
* @parameter expression="${session}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenSession session;
|
||||
private List reports;
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.plugin.Mojo#execute()
|
||||
|
@ -239,6 +224,21 @@ public class DoxiaMojo
|
|||
attributes.put( "outputEncoding", outputEncoding );
|
||||
}
|
||||
|
||||
Map categories = categorizeReports( reports );
|
||||
|
||||
List projectInfos = (List) categories.get( MavenReport.CATEGORY_PROJECT_INFORMATION );
|
||||
List projectReports = (List) categories.get( MavenReport.CATEGORY_PROJECT_REPORTS );
|
||||
|
||||
if ( projectInfos == null )
|
||||
{
|
||||
projectInfos = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
if ( projectReports == null )
|
||||
{
|
||||
projectReports = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
List localesList = initLocalesList();
|
||||
|
@ -264,7 +264,7 @@ public class DoxiaMojo
|
|||
}
|
||||
|
||||
// Generate static site
|
||||
File siteDirectoryFile = new File( siteDirectory );
|
||||
File siteDirectoryFile = siteDirectory;
|
||||
if ( !locale.getLanguage().equals( defaultLocale.getLanguage() ) )
|
||||
{
|
||||
siteDirectoryFile = new File( siteDirectory, locale.getLanguage() );
|
||||
|
@ -278,11 +278,9 @@ public class DoxiaMojo
|
|||
}
|
||||
|
||||
// Handle the GeneratedSite Directory
|
||||
File generatedSiteFile = new File( generatedSiteDirectory );
|
||||
|
||||
if ( generatedSiteFile.exists() )
|
||||
if ( generatedSiteDirectory.exists() )
|
||||
{
|
||||
tryToFindDuplicates( generatedSiteFile, duplicate );
|
||||
tryToFindDuplicates( generatedSiteDirectory, duplicate );
|
||||
}
|
||||
|
||||
// Exception if a file is duplicate
|
||||
|
@ -292,28 +290,11 @@ public class DoxiaMojo
|
|||
throw new MavenReportException( msg );
|
||||
}
|
||||
|
||||
List reports = getReports();
|
||||
|
||||
Map categories = categorizeReports( reports );
|
||||
|
||||
List projectInfos = (List) categories.get( MavenReport.CATEGORY_PROJECT_INFORMATION );
|
||||
List projectReports = (List) categories.get( MavenReport.CATEGORY_PROJECT_REPORTS );
|
||||
|
||||
if ( projectInfos == null )
|
||||
{
|
||||
projectInfos = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
if ( projectReports == null )
|
||||
{
|
||||
projectReports = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
String siteDescriptor = getSiteDescriptor( reports, locale, projectInfos, projectReports );
|
||||
|
||||
if ( generatedSiteFile.exists() )
|
||||
if ( generatedSiteDirectory.exists() )
|
||||
{
|
||||
siteRenderer.render( generatedSiteFile, outputDirectory, siteDescriptor, template, attributes,
|
||||
siteRenderer.render( generatedSiteDirectory, outputDirectory, siteDescriptor, template, attributes,
|
||||
locale );
|
||||
}
|
||||
|
||||
|
@ -437,6 +418,7 @@ public class DoxiaMojo
|
|||
MavenReport report = (MavenReport) i.next();
|
||||
|
||||
List category = (List) categories.get( report.getCategoryName() );
|
||||
|
||||
if ( category == null )
|
||||
{
|
||||
category = new ArrayList();
|
||||
|
@ -699,7 +681,7 @@ public class DoxiaMojo
|
|||
{
|
||||
String outputFileName = "index.html";
|
||||
|
||||
SiteRendererSink sink = siteRenderer.createSink( new File( siteDirectory ), outputFileName, siteDescriptor );
|
||||
SiteRendererSink sink = siteRenderer.createSink( siteDirectory, outputFileName, siteDescriptor );
|
||||
|
||||
String title = i18n.getString( "site-plugin", locale, "report.index.title" ).trim() + " " + project.getName();
|
||||
|
||||
|
@ -775,8 +757,7 @@ public class DoxiaMojo
|
|||
|
||||
String outputFileName = reportFileName + ".html";
|
||||
|
||||
SiteRendererSink sink = siteRenderer.createSink( new File( siteDirectory ), outputFileName,
|
||||
siteDescriptor );
|
||||
SiteRendererSink sink = siteRenderer.createSink( siteDirectory, outputFileName, siteDescriptor );
|
||||
|
||||
report.generate( sink, locale );
|
||||
|
||||
|
@ -803,7 +784,7 @@ public class DoxiaMojo
|
|||
{
|
||||
String outputFileName = "project-info.html";
|
||||
|
||||
SiteRendererSink sink = siteRenderer.createSink( new File( siteDirectory ), outputFileName, siteDescriptor );
|
||||
SiteRendererSink sink = siteRenderer.createSink( siteDirectory, outputFileName, siteDescriptor );
|
||||
|
||||
String title = i18n.getString( "site-plugin", locale, "report.information.title" );
|
||||
|
||||
|
@ -884,7 +865,7 @@ public class DoxiaMojo
|
|||
{
|
||||
String outputFileName = "maven-reports.html";
|
||||
|
||||
SiteRendererSink sink = siteRenderer.createSink( new File( siteDirectory ), outputFileName, siteDescriptor );
|
||||
SiteRendererSink sink = siteRenderer.createSink( siteDirectory, outputFileName, siteDescriptor );
|
||||
|
||||
String title = i18n.getString( "site-plugin", locale, "report.project.title" );
|
||||
|
||||
|
@ -1037,76 +1018,12 @@ public class DoxiaMojo
|
|||
{
|
||||
if ( locale.getLanguage().equals( defaultLocale.getLanguage() ) )
|
||||
{
|
||||
return new File( outputDirectory );
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
return new File( outputDirectory, locale.getLanguage() );
|
||||
}
|
||||
|
||||
private List getReports()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
// TODO: not the best solution. Perhaps a mojo tag that causes the plugin manager to populate project reports instead?
|
||||
|
||||
List reportPlugins = project.getReportPlugins();
|
||||
|
||||
if ( project.getModel().getReports() != null )
|
||||
{
|
||||
getLog().error(
|
||||
"DEPRECATED: Plugin contains a <reports/> section: this is IGNORED - please use <reporting/> instead." );
|
||||
}
|
||||
|
||||
List reports = new ArrayList();
|
||||
if ( reportPlugins != null )
|
||||
{
|
||||
for ( Iterator it = reportPlugins.iterator(); it.hasNext(); )
|
||||
{
|
||||
ReportPlugin reportPlugin = (ReportPlugin) it.next();
|
||||
|
||||
try
|
||||
{
|
||||
List reportSets = reportPlugin.getReportSets();
|
||||
|
||||
List reportsList = new ArrayList();
|
||||
|
||||
if ( reportSets == null || reportSets.isEmpty() )
|
||||
{
|
||||
reportsList = pluginManager.getReports( reportPlugin, null, project, session );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( Iterator j = reportSets.iterator(); j.hasNext(); )
|
||||
{
|
||||
ReportSet reportSet = (ReportSet) j.next();
|
||||
|
||||
reportsList = pluginManager.getReports( reportPlugin, reportSet, project, session );
|
||||
}
|
||||
}
|
||||
|
||||
reports.addAll( reportsList );
|
||||
}
|
||||
catch ( PluginManagerException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error getting reports", e );
|
||||
}
|
||||
catch ( PluginVersionResolutionException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error getting reports", e );
|
||||
}
|
||||
catch ( PluginConfigurationException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error getting reports", e );
|
||||
}
|
||||
catch ( ArtifactResolutionException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Cannot find report plugin", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
return reports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method that try to find duplicate files in sub-directories of a given directory.
|
||||
* <p>The scan is case sensitive.</p>
|
||||
|
|
|
@ -63,6 +63,8 @@ public class MetadataTag
|
|||
|
||||
private String lifecyclePhase;
|
||||
|
||||
private boolean requiresReports;
|
||||
|
||||
protected boolean alwaysProcessChildren()
|
||||
{
|
||||
return false;
|
||||
|
@ -133,6 +135,7 @@ public class MetadataTag
|
|||
throw new TagExecutionException( getTagInfo(), "One or more mojo parameters is invalid.", e );
|
||||
}
|
||||
|
||||
descriptor.setRequiresReports( requiresReports );
|
||||
descriptor.setDependencyResolutionRequired( requiresDependencyResolution );
|
||||
descriptor.setProjectRequired( requiresProject );
|
||||
descriptor.setAggregator( aggregator );
|
||||
|
@ -201,12 +204,12 @@ public class MetadataTag
|
|||
|
||||
public void setAggregator( boolean aggregator )
|
||||
{
|
||||
this.aggregator = aggregator;
|
||||
this.aggregator = aggregator;
|
||||
}
|
||||
|
||||
public void setInheritByDefault( boolean inheritByDefault )
|
||||
{
|
||||
this.inheritByDefault = inheritByDefault;
|
||||
this.inheritByDefault = inheritByDefault;
|
||||
}
|
||||
|
||||
public void setRequiresOnline( boolean requiresOnline )
|
||||
|
@ -229,4 +232,8 @@ public class MetadataTag
|
|||
this.lifecyclePhase = lifecyclePhase;
|
||||
}
|
||||
|
||||
public void setRequiresReports( boolean requiresReports )
|
||||
{
|
||||
this.requiresReports = requiresReports;
|
||||
}
|
||||
}
|
|
@ -30,19 +30,26 @@ import java.util.List;
|
|||
public class ParametersTag
|
||||
extends AbstractMarmaladeTag
|
||||
{
|
||||
private boolean requiresReports = false;
|
||||
|
||||
private List parameters = new ArrayList();
|
||||
|
||||
protected void doExecute( MarmaladeExecutionContext context ) throws MarmaladeExecutionException
|
||||
protected void doExecute( MarmaladeExecutionContext context )
|
||||
throws MarmaladeExecutionException
|
||||
{
|
||||
processChildren( context );
|
||||
|
||||
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
|
||||
metadataTag.setParameters( parameters );
|
||||
metadataTag.setRequiresReports( requiresReports );
|
||||
}
|
||||
|
||||
public void addParameter( Parameter parameter )
|
||||
{
|
||||
if ( "${reports}".equals( parameter.getExpression() ) )
|
||||
{
|
||||
requiresReports = true;
|
||||
}
|
||||
this.parameters.add( parameter );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue