Working on: MNG-377

o Normalized all references to plugins to use either o.a.m.model.Plugin or o.a.m.plugin.PluginDescriptor instances

o Changed DefaultLifecycleExecutor, PluginManager, DefaultPluginManager, MavenPluginCollector, and DoxiaMojo to reflect the above

o Added mapped-plugin resolution of goal prefixes to the DefaultLifecycleExecutor

o Added caching of PluginMappingManager instance inside of MavenSession

o Modified SettingsUtils to be more resistant to null String-Lists for pluginGroups and activeProfiles during merge.

o Added checks to MavenProject.addPlugin(..) to only add if the plugin doesn't already exist in the model.

Next step is to modify installation and deployment process for plugins to publish plugins.xml repository metadata.



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@209677 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-07-07 23:50:25 +00:00
parent 73184be8e3
commit 91dfd62176
9 changed files with 266 additions and 184 deletions

View File

@ -18,6 +18,7 @@ package org.apache.maven.execution;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.plugin.mapping.PluginMappingManager;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
@ -43,6 +44,8 @@ public class MavenSession
private EventDispatcher eventDispatcher;
private PluginMappingManager pluginMappingManager;
// TODO: make this the central one, get rid of build settings...
private final Settings settings;
@ -132,4 +135,14 @@ public class MavenSession
{
return settings;
}
public void setPluginMappingManager( PluginMappingManager pluginMappingManager )
{
this.pluginMappingManager = pluginMappingManager;
}
public PluginMappingManager getPluginMappingManager()
{
return pluginMappingManager;
}
}

View File

@ -17,6 +17,7 @@ package org.apache.maven.lifecycle;
*/
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManagementException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.execution.MavenSession;
@ -36,6 +37,8 @@ import org.apache.maven.plugin.lifecycle.Execution;
import org.apache.maven.plugin.lifecycle.Lifecycle;
import org.apache.maven.plugin.lifecycle.Phase;
import org.apache.maven.plugin.mapping.MavenPluginMappingBuilder;
import org.apache.maven.plugin.mapping.PluginMappingManagementException;
import org.apache.maven.plugin.mapping.PluginMappingManager;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.injection.ModelDefaultsInjector;
@ -123,7 +126,8 @@ public class DefaultLifecycleExecutor
}
private void executeGoal( String task, MavenSession session, MavenProject project )
throws LifecycleExecutionException, PluginNotFoundException, MojoExecutionException, ArtifactResolutionException
throws LifecycleExecutionException, PluginNotFoundException, MojoExecutionException,
ArtifactResolutionException
{
if ( phases.contains( task ) )
{
@ -280,8 +284,8 @@ public class DefaultLifecycleExecutor
String goal = tok.nextToken().trim();
MojoDescriptor mojoDescriptor = getMojoDescriptor( goal, session, project );
addToLifecycleMappings( lifecycleMappings, phase, new MojoExecution( mojoDescriptor ),
session.getSettings() );
addToLifecycleMappings( lifecycleMappings, phase, new MojoExecution( mojoDescriptor ), session
.getSettings() );
}
}
@ -308,7 +312,8 @@ public class DefaultLifecycleExecutor
if ( plugin.getGoals() != null && !plugin.getGoals().isEmpty() )
{
getLogger().warn(
"DEPRECATED: goal definitions for plugin '" + plugin.getKey() + "' must be in an executions element" );
"DEPRECATED: goal definitions for plugin '" + plugin.getKey()
+ "' must be in an executions element" );
}
PluginDescriptor pluginDescriptor;
@ -341,18 +346,11 @@ public class DefaultLifecycleExecutor
private PluginDescriptor verifyPlugin( Plugin plugin, MavenSession session, MavenProject project )
throws ArtifactResolutionException, LifecycleExecutionException
{
String groupId = plugin.getGroupId();
String artifactId = plugin.getArtifactId();
String version = plugin.getVersion();
PluginDescriptor pluginDescriptor;
try
{
ArtifactRepository localRepository = session.getLocalRepository();
pluginDescriptor = pluginManager.verifyPlugin( groupId, artifactId, version, project, session.getSettings(),
localRepository );
pluginDescriptor = pluginManager.verifyPlugin( plugin, project, session.getSettings(), localRepository );
}
catch ( PluginManagerException e )
{
@ -368,8 +366,7 @@ public class DefaultLifecycleExecutor
/**
* @deprecated
*/
private void bindGoalMapToLifecycle( PluginDescriptor pluginDescriptor, Map goalMap, Map phaseMap,
Settings settings )
private void bindGoalMapToLifecycle( PluginDescriptor pluginDescriptor, Map goalMap, Map phaseMap, Settings settings )
{
for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
{
@ -470,10 +467,8 @@ public class DefaultLifecycleExecutor
private MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project )
throws ArtifactResolutionException, LifecycleExecutionException
{
String groupId = null;
String artifactId = null;
String version = null;
String goal = null;
Plugin plugin = null;
PluginDescriptor pluginDescriptor = null;
@ -484,43 +479,85 @@ public class DefaultLifecycleExecutor
String prefix = tok.nextToken();
goal = tok.nextToken();
String id = pluginManager.getPluginIdFromPrefix( prefix );
// Steps for retrieving the plugin model instance:
// 1. request directly from the plugin collector by prefix
pluginDescriptor = pluginManager.getPluginDescriptorForPrefix( prefix );
if ( id == null )
if ( pluginDescriptor != null )
{
groupId = PluginDescriptor.getDefaultPluginGroupId();
artifactId = PluginDescriptor.getDefaultPluginArtifactId( prefix );
plugin = new Plugin();
plugin.setGroupId( pluginDescriptor.getGroupId() );
plugin.setArtifactId( pluginDescriptor.getArtifactId() );
plugin.setVersion( pluginDescriptor.getVersion() );
}
else
// 2. use the plugin resolver to resolve the prefix in the search groups
if ( plugin == null )
{
tok = new StringTokenizer( id, ":" );
groupId = tok.nextToken();
artifactId = tok.nextToken();
version = tok.nextToken();
PluginMappingManager mappingManager = session.getPluginMappingManager();
// don't reassemble the plugin mappings if the session has already been configured with them.
if ( mappingManager == null )
{
try
{
List pluginGroupIds = session.getSettings().getPluginGroups();
List pluginRepositories = project.getPluginArtifactRepositories();
ArtifactRepository localRepository = session.getLocalRepository();
mappingManager = pluginMappingBuilder.loadPluginMappings( pluginGroupIds, pluginRepositories,
localRepository );
// lazily configure this on the session.
session.setPluginMappingManager( mappingManager );
}
catch ( RepositoryMetadataManagementException e )
{
throw new LifecycleExecutionException( "Cannot load plugin mappings.", e );
}
catch ( PluginMappingManagementException e )
{
throw new LifecycleExecutionException( "Cannot load plugin mappings.", e );
}
}
plugin = mappingManager.getByPrefix( prefix );
}
// 3. default to o.a.m.plugins and maven-<prefix>-plugin
if ( plugin == null )
{
plugin = new Plugin();
plugin.setGroupId( PluginDescriptor.getDefaultPluginGroupId() );
plugin.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( prefix ) );
}
for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
{
Plugin plugin = (Plugin) i.next();
Plugin buildPlugin = (Plugin) i.next();
if ( plugin.getGroupId().equals( groupId ) && plugin.getArtifactId().equals( artifactId ) )
if ( buildPlugin.getKey().equals( plugin.getKey() ) )
{
version = plugin.getVersion();
plugin = buildPlugin;
break;
}
}
}
else if ( numTokens == 4 )
{
groupId = tok.nextToken();
artifactId = tok.nextToken();
version = tok.nextToken();
plugin = new Plugin();
plugin.setGroupId( tok.nextToken() );
plugin.setArtifactId( tok.nextToken() );
plugin.setVersion( tok.nextToken() );
goal = tok.nextToken();
}
else
{
String message = "Invalid task '" + task + "': you must specify a valid lifecycle phase, or" +
" a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
String message = "Invalid task '" + task + "': you must specify a valid lifecycle phase, or"
+ " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
throw new LifecycleExecutionException( message );
}
@ -528,8 +565,8 @@ public class DefaultLifecycleExecutor
{
try
{
pluginDescriptor = pluginManager.verifyPlugin( groupId, artifactId, version, project,
session.getSettings(), session.getLocalRepository() );
pluginDescriptor = pluginManager.verifyPlugin( plugin, project, session.getSettings(), session
.getLocalRepository() );
}
catch ( PluginManagerException e )
{
@ -541,8 +578,7 @@ public class DefaultLifecycleExecutor
}
}
injectHandlerPluginConfiguration( project, pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(),
pluginDescriptor.getVersion() );
injectHandlerPluginConfiguration( project, plugin );
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
if ( mojoDescriptor == null )
@ -553,26 +589,22 @@ public class DefaultLifecycleExecutor
return mojoDescriptor;
}
private void injectHandlerPluginConfiguration( MavenProject project, String groupId, String artifactId,
String version )
private void injectHandlerPluginConfiguration( MavenProject project, Plugin plugin )
{
String key = Plugin.constructKey( groupId, artifactId );
Plugin plugin = (Plugin) project.getBuild().getPluginsAsMap().get( key );
String key = plugin.getKey();
if ( plugin == null )
Plugin buildPlugin = (Plugin) project.getBuild().getPluginsAsMap().get( key );
if ( buildPlugin == null )
{
plugin = new Plugin();
plugin.setGroupId( groupId );
plugin.setArtifactId( artifactId );
plugin.setVersion( version );
PluginManagement pluginManagement = project.getPluginManagement();
if ( pluginManagement != null )
{
Plugin def = (Plugin) pluginManagement.getPluginsAsMap().get( key );
if ( def != null )
Plugin managedPlugin = (Plugin) pluginManagement.getPluginsAsMap().get( key );
if ( managedPlugin != null )
{
modelDefaultsInjector.mergePluginWithDefaults( plugin, def );
modelDefaultsInjector.mergePluginWithDefaults( plugin, managedPlugin );
}
}

View File

@ -29,6 +29,7 @@ import org.apache.maven.artifact.resolver.filter.InversionArtifactFilter;
import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter;
import org.apache.maven.execution.MavenSession;
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;
@ -109,44 +110,55 @@ public class DefaultPluginManager
//
// ----------------------------------------------------------------------
public String getPluginIdFromPrefix( String prefix )
public PluginDescriptor getPluginDescriptorForPrefix( String prefix )
{
return pluginCollector.getPluginIdFromPrefix( prefix );
return pluginCollector.getPluginDescriptorForPrefix( prefix );
}
public PluginDescriptor verifyPlugin( String groupId, String artifactId, String version, MavenProject project,
Settings settings, ArtifactRepository localRepository )
public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
ArtifactRepository localRepository )
throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException
{
// TODO: this should be possibly outside
// [HTTP-301] All version-resolution logic has been moved to DefaultPluginVersionManager. :)
if ( version == null )
if ( plugin.getVersion() == null )
{
version = pluginVersionManager.resolvePluginVersion( groupId, artifactId, project, settings,
localRepository );
String groupId = plugin.getGroupId();
String artifactId = plugin.getArtifactId();
plugin.setVersion( pluginVersionManager.resolvePluginVersion( groupId, artifactId, project, settings,
localRepository ) );
}
// TODO: this might result in an artifact "RELEASE" being resolved continuously
if ( !pluginCollector.isPluginInstalled( groupId, artifactId ) )
if ( !pluginCollector.isPluginInstalled( plugin ) )
{
try
{
Artifact pluginArtifact = artifactFactory.createArtifact( groupId, artifactId, version,
Artifact pluginArtifact = artifactFactory.createArtifact( plugin.getGroupId(),
plugin.getArtifactId(),
plugin.getVersion(),
Artifact.SCOPE_RUNTIME,
MojoDescriptor.MAVEN_PLUGIN );
addPlugin( groupId, artifactId, version, pluginArtifact, project, localRepository );
// TODO: [jc; 2005-july-06] what's this for?
//plugin.setVersion( pluginArtifact.getBaseVersion() );
version = pluginArtifact.getBaseVersion();
addPlugin( plugin, pluginArtifact, project, localRepository );
project.addPlugin( plugin );
}
catch ( PlexusContainerException e )
{
throw new PluginManagerException(
"Error occurred in the artifact container attempting to download plugin " + groupId + ":" +
artifactId, e );
"Error occurred in the artifact container attempting to download plugin " + plugin.getKey(), e );
}
catch ( ArtifactResolutionException e )
{
String groupId = plugin.getGroupId();
String artifactId = plugin.getArtifactId();
String version = plugin.getVersion();
if (
( groupId == null || artifactId == null || version == null ||
( groupId.equals( e.getGroupId() ) && artifactId.equals( e.getArtifactId() ) &&
@ -160,23 +172,22 @@ public class DefaultPluginManager
}
}
}
return pluginCollector.getPluginDescriptor( groupId, artifactId, version );
return pluginCollector.getPluginDescriptor( plugin );
}
protected void addPlugin( String groupId, String artifactId, String version, Artifact pluginArtifact, MavenProject project,
protected void addPlugin( Plugin plugin, Artifact pluginArtifact, MavenProject project,
ArtifactRepository localRepository )
throws ArtifactResolutionException, PlexusContainerException
{
String pluginKey = Plugin.constructKey( groupId, artifactId );
artifactResolver.resolve( pluginArtifact, project.getPluginArtifactRepositories(), localRepository );
PlexusContainer child = container.createChildContainer( pluginKey, Collections
PlexusContainer child = container.createChildContainer( plugin.getKey(), Collections
.singletonList( pluginArtifact.getFile() ), Collections.EMPTY_MAP, Collections.singletonList( pluginCollector ) );
// this plugin's descriptor should have been discovered in the child creation, so we should be able to
// circle around and set the artifacts and class realm
PluginDescriptor addedPlugin = pluginCollector.getPluginDescriptor( groupId, artifactId, version );
PluginDescriptor addedPlugin = pluginCollector.getPluginDescriptor( plugin );
addedPlugin.setClassRealm( child.getContainerRealm() );
@ -186,18 +197,6 @@ public class DefaultPluginManager
addedPlugin.setArtifacts( Collections.singletonList( pluginArtifact ) );
}
// private void releaseComponent( Object component )
// {
// try
// {
// container.release( component );
// }
// catch ( ComponentLifecycleException e )
// {
// getLogger().error( "Error releasing component - ignoring", e );
// }
// }
// ----------------------------------------------------------------------
// Mojo execution
// ----------------------------------------------------------------------
@ -291,11 +290,17 @@ public class DefaultPluginManager
}
}
public List getReports( String groupId, String artifactId, String version, ReportSet reportSet,
MavenSession session, MavenProject project )
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException
public List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project,
MavenSession session, ArtifactRepository localRepository )
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException,
ArtifactResolutionException
{
PluginDescriptor pluginDescriptor = pluginCollector.getPluginDescriptor( groupId, artifactId, version );
Plugin forLookup = new Plugin();
forLookup.setGroupId( reportPlugin.getGroupId() );
forLookup.setArtifactId( reportPlugin.getArtifactId() );
forLookup.setVersion( reportPlugin.getVersion() );
PluginDescriptor pluginDescriptor = verifyPlugin( forLookup, project, session.getSettings(), localRepository );
List reports = new ArrayList();
for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
@ -317,7 +322,7 @@ public class DefaultPluginManager
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, id );
String executionId = mojoExecution.getExecutionId();
Xpp3Dom dom = project.getReportConfiguration( groupId, artifactId, executionId );
Xpp3Dom dom = project.getReportConfiguration( reportPlugin.getGroupId(), reportPlugin.getArtifactId(), executionId );
reports.add( getConfiguredMojo( mojoDescriptor, session, dom, project ) );
}

View File

@ -1,6 +1,7 @@
package org.apache.maven.plugin;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
@ -9,6 +10,7 @@ import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@ -34,9 +36,8 @@ public class MavenPluginCollector
{
PluginDescriptor pluginDescriptor = (PluginDescriptor) componentSetDescriptor;
// String key = pluginDescriptor.getId();
// TODO: see comment in getPluginDescriptor
String key = pluginDescriptor.getGroupId() + ":" + pluginDescriptor.getArtifactId();
String key = Plugin.constructKey( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId() );
if ( !pluginsInProcess.contains( key ) )
{
@ -48,33 +49,29 @@ public class MavenPluginCollector
// we also need to deal with multiple versions somehow - currently, first wins
if ( !pluginIdsByPrefix.containsKey( pluginDescriptor.getGoalPrefix() ) )
{
pluginIdsByPrefix.put( pluginDescriptor.getGoalPrefix(), pluginDescriptor.getId() );
pluginIdsByPrefix.put( pluginDescriptor.getGoalPrefix(), pluginDescriptor );
}
}
}
}
public PluginDescriptor getPluginDescriptor( String groupId, String artifactId, String version )
public PluginDescriptor getPluginDescriptor( Plugin plugin )
{
// TODO: include version, but can't do this in the plugin manager as it is not resolved to the right version
// at that point. Instead, move the duplication check to the artifact container, or store it locally based on
// the unresolved version?
return (PluginDescriptor) pluginDescriptors.get( Plugin.constructKey( groupId, artifactId ) );
return (PluginDescriptor) pluginDescriptors.get( plugin.getKey() );
}
public boolean isPluginInstalled( String groupId, String artifactId )
public boolean isPluginInstalled( Plugin plugin )
{
// String key = PluginDescriptor.constructPluginKey( groupId, artifactId, version );
// TODO: see comment in getPluginDescriptor
return pluginDescriptors.containsKey( Plugin.constructKey( groupId, artifactId ) );
return pluginDescriptors.containsKey( plugin.getKey() );
}
public String getPluginIdFromPrefix( String prefix )
public PluginDescriptor getPluginDescriptorForPrefix( String prefix )
{
if ( !pluginIdsByPrefix.containsKey( prefix ) )
{
// TODO: lookup remotely
}
return (String) pluginIdsByPrefix.get( prefix );
return (PluginDescriptor) pluginIdsByPrefix.get( prefix );
}
}

View File

@ -23,6 +23,8 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.project.MavenProject;
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 java.util.List;
@ -38,13 +40,14 @@ public interface PluginManager
void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
throws MojoExecutionException, PluginManagerException, ArtifactResolutionException;
String getPluginIdFromPrefix( String prefix );
PluginDescriptor getPluginDescriptorForPrefix( String prefix );
PluginDescriptor verifyPlugin( String groupId, String artifactId, String version, MavenProject project,
Settings settings, ArtifactRepository localRepository )
PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
ArtifactRepository localRepository )
throws ArtifactResolutionException, PluginManagerException, PluginVersionResolutionException;
List getReports( String groupId, String artifactId, String version, ReportSet reportSet, MavenSession session,
MavenProject project )
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException;
List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session,
ArtifactRepository localRepository )
throws PluginManagerException, PluginVersionResolutionException, PluginConfigurationException,
ArtifactResolutionException;
}

View File

@ -28,6 +28,8 @@ public class DefaultPluginMappingBuilder
{
PluginMappingManager mappingManager = new PluginMappingManager();
if ( pluginGroupIds != null )
{
for ( Iterator it = pluginGroupIds.iterator(); it.hasNext(); )
{
String groupId = (String) it.next();
@ -36,13 +38,19 @@ public class DefaultPluginMappingBuilder
PluginMap pluginMap = readPluginMap( mappingFile );
if ( pluginMap != null )
{
mappingManager.addPluginMap( pluginMap );
}
}
}
return mappingManager;
}
private PluginMap readPluginMap( File mappingFile ) throws PluginMappingManagementException
{
if( mappingFile.exists() )
{
Reader fileReader = null;
try
@ -66,6 +74,11 @@ public class DefaultPluginMappingBuilder
IOUtil.close( fileReader );
}
}
else
{
return null;
}
}
private File resolveMappingMetadata( String groupId, List pluginRepositories, ArtifactRepository localRepository )
throws RepositoryMetadataManagementException

View File

@ -744,23 +744,18 @@ public class DoxiaMojo
{
org.apache.maven.model.ReportPlugin reportPlugin = (org.apache.maven.model.ReportPlugin) it.next();
try
{
pluginManager.verifyPlugin( reportPlugin.getGroupId(), reportPlugin.getArtifactId(),
reportPlugin.getVersion(), project, settings, localRepository );
}
catch ( ArtifactResolutionException e )
{
throw new MojoExecutionException( "Cannot find report plugin", e );
}
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
// {
// 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
{
@ -770,12 +765,11 @@ public class DoxiaMojo
if ( reportSets == null || reportSets.isEmpty() )
{
reportsList = pluginManager.getReports( reportPlugin.getGroupId(),
reportPlugin.getArtifactId(),
reportPlugin.getVersion(),
reportsList = pluginManager.getReports( reportPlugin,
null,
project,
session,
project );
localRepository );
}
else
@ -784,12 +778,11 @@ public class DoxiaMojo
{
ReportSet reportSet = (ReportSet) j.next();
reportsList = pluginManager.getReports( reportPlugin.getGroupId(),
reportPlugin.getArtifactId(),
reportPlugin.getVersion(),
reportsList = pluginManager.getReports( reportPlugin,
reportSet,
project,
session,
project );
localRepository );
}
}
@ -816,6 +809,10 @@ public class DoxiaMojo
{
throw new MojoExecutionException( "Error getting reports", e );
}
catch ( ArtifactResolutionException e )
{
throw new MojoExecutionException( "Cannot find report plugin", e );
}
}
}
return reports;

View File

@ -854,8 +854,11 @@ public class MavenProject
model.setBuild( build );
}
if ( !build.getPluginsAsMap().containsKey( plugin.getKey() ) )
{
build.addPlugin( plugin );
}
}
public List getCollectedProjects()
{

View File

@ -2,6 +2,7 @@ package org.apache.maven.settings;
import org.codehaus.plexus.util.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -43,6 +44,14 @@ public final class SettingsUtils
List dominantActiveProfiles = dominant.getActiveProfiles();
List recessiveActiveProfiles = recessive.getActiveProfiles();
if ( recessiveActiveProfiles != null )
{
if ( dominantActiveProfiles == null )
{
dominantActiveProfiles = new ArrayList();
dominant.setActiveProfiles( dominantActiveProfiles );
}
for ( Iterator it = recessiveActiveProfiles.iterator(); it.hasNext(); )
{
String profileId = (String) it.next();
@ -54,10 +63,19 @@ public final class SettingsUtils
dominant.getRuntimeInfo().setActiveProfileSourceLevel( profileId, recessiveSourceLevel );
}
}
}
List dominantPluginGroupIds = dominant.getPluginGroups();
List recessivePluginGroupIds = recessive.getPluginGroups();
if( recessivePluginGroupIds != null )
{
if( dominantPluginGroupIds == null )
{
dominantPluginGroupIds = new ArrayList();
dominant.setPluginGroups( dominantPluginGroupIds );
}
for ( Iterator it = recessivePluginGroupIds.iterator(); it.hasNext(); )
{
String pluginGroupId = (String) it.next();
@ -69,6 +87,7 @@ public final class SettingsUtils
dominant.getRuntimeInfo().setPluginGroupIdSourceLevel( pluginGroupId, recessiveSourceLevel );
}
}
}
if ( StringUtils.isEmpty( dominant.getLocalRepository() ) )
{