mirror of https://github.com/apache/maven.git
partially fixing problem with plugin-dependency loading...now, we're including maven-plugin-api in the plugin realm somehow, which means the standard artifact filter isn't working.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@497696 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5a2439e750
commit
5bd4c1927c
|
@ -1243,6 +1243,8 @@ public class DefaultLifecycleExecutor
|
|||
private PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, MavenSession session )
|
||||
throws LifecycleExecutionException, PluginNotFoundException
|
||||
{
|
||||
getLogger().debug( "Verifying plugin: " + plugin.getKey() );
|
||||
|
||||
PluginDescriptor pluginDescriptor;
|
||||
try
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.maven.plugin;
|
|||
|
||||
import org.apache.maven.ArtifactFilterManager;
|
||||
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;
|
||||
|
@ -83,6 +84,7 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -337,6 +339,8 @@ public class DefaultPluginManager
|
|||
|
||||
pluginDescriptor.setArtifacts( new ArrayList( artifacts ) );
|
||||
|
||||
getLogger().debug( "Realm for plugin: " + plugin.getKey() + ":\n" + componentRealm );
|
||||
|
||||
pluginDescriptor.setClassRealm( componentRealm );
|
||||
}
|
||||
|
||||
|
@ -387,7 +391,9 @@ public class DefaultPluginManager
|
|||
artifactMetadataSource,
|
||||
coreArtifactFilterManager.getArtifactFilter() );
|
||||
|
||||
Set resolved = result.getArtifacts();
|
||||
List resolved = new ArrayList( result.getArtifacts() );
|
||||
|
||||
getLogger().info( "Main plugin artifacts: " + resolved );
|
||||
|
||||
// Also resolve the plugin dependencies specified in <plugin><dependencies>:
|
||||
resolved.addAll( artifactResolver.resolveTransitively( projectPluginDependencies,
|
||||
|
@ -397,6 +403,8 @@ public class DefaultPluginManager
|
|||
artifactMetadataSource,
|
||||
coreArtifactFilterManager.getArtifactFilter() ).getArtifacts() );
|
||||
|
||||
getLogger().info( "After adding project-level plugin dependencies: " + resolved );
|
||||
|
||||
for ( Iterator it = resolved.iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact artifact = (Artifact) it.next();
|
||||
|
@ -413,13 +421,45 @@ public class DefaultPluginManager
|
|||
|
||||
resolveCoreArtifacts( unresolved, localRepository, resolutionGroup.getResolutionRepositories() );
|
||||
|
||||
List allResolved = new ArrayList( resolved.size() + unresolved.size() );
|
||||
Set allResolved = new LinkedHashSet( resolved.size() + unresolved.size() );
|
||||
|
||||
allResolved.addAll( resolved );
|
||||
Set seenVersionlessKeys = new HashSet();
|
||||
|
||||
allResolved.addAll( unresolved );
|
||||
for ( Iterator it = resolved.iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact resolvedArtifact = (Artifact) it.next();
|
||||
|
||||
return resolved;
|
||||
String versionlessKey = ArtifactUtils.versionlessKey( resolvedArtifact );
|
||||
if ( !seenVersionlessKeys.contains( versionlessKey ) )
|
||||
{
|
||||
allResolved.add( resolvedArtifact );
|
||||
seenVersionlessKeys.add( versionlessKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().info( "NOT including: " + resolvedArtifact.getId() + " in plugin dependencies." );
|
||||
}
|
||||
}
|
||||
|
||||
for ( Iterator it = unresolved.iterator(); it.hasNext(); )
|
||||
{
|
||||
Artifact unresolvedArtifact = (Artifact) it.next();
|
||||
|
||||
String versionlessKey = ArtifactUtils.versionlessKey( unresolvedArtifact );
|
||||
if ( !seenVersionlessKeys.contains( versionlessKey ) )
|
||||
{
|
||||
allResolved.add( unresolvedArtifact );
|
||||
seenVersionlessKeys.add( versionlessKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().info( "NOT including: " + unresolvedArtifact.getId() + " in plugin dependencies." );
|
||||
}
|
||||
}
|
||||
|
||||
getLogger().info( "Using the following artifacts for classpath of: " + pluginArtifact.getId() + ":\n\n" + allResolved.toString().replace( ',', '\n' ) );
|
||||
|
||||
return allResolved;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -624,7 +664,7 @@ public class DefaultPluginManager
|
|||
|
||||
ClassRealm oldRealm = DefaultPlexusContainer.setLookupRealm( realm );
|
||||
|
||||
plugin = (Mojo) container.lookup( Mojo.ROLE, mojoDescriptor.getRoleHint() );
|
||||
plugin = (Mojo) container.lookup( Mojo.ROLE, mojoDescriptor.getRoleHint(), realm );
|
||||
|
||||
DefaultPlexusContainer.setLookupRealm( oldRealm );
|
||||
|
||||
|
|
Loading…
Reference in New Issue