mirror of https://github.com/apache/maven.git
MNG-5003 populate mojo descriptor with cached plugin realm
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1067279 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1c6745c2a8
commit
a7d9b689fa
|
@ -311,6 +311,10 @@ public class DefaultMavenPluginManager
|
|||
{
|
||||
pluginDescriptor.setClassRealm( cacheRecord.realm );
|
||||
pluginDescriptor.setArtifacts( new ArrayList<Artifact>( cacheRecord.artifacts ) );
|
||||
for ( ComponentDescriptor<?> componentDescriptor : pluginDescriptor.getComponents() )
|
||||
{
|
||||
componentDescriptor.setRealm( cacheRecord.realm );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
|||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.component.repository.ComponentDescriptor;
|
||||
|
||||
public class PluginManagerTest
|
||||
extends AbstractCoreMavenComponentTestCase
|
||||
|
@ -273,4 +274,44 @@ public class PluginManagerTest
|
|||
assertEquals( artifactId, pd.getArtifactId() );
|
||||
assertEquals( version, pd.getVersion() );
|
||||
}
|
||||
|
||||
public void testPluginRealmCache()
|
||||
throws Exception
|
||||
{
|
||||
RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
|
||||
repositoryRequest.setLocalRepository( getLocalRepository() );
|
||||
repositoryRequest.setRemoteRepositories( getPluginArtifactRepositories() );
|
||||
|
||||
// prime realm cache
|
||||
MavenSession session = createMavenSession( getProject( "project-contributing-system-scope-plugin-dep" ) );
|
||||
MavenProject project = session.getCurrentProject();
|
||||
Plugin plugin = project.getPlugin( "org.apache.maven.its.plugins:maven-it-plugin" );
|
||||
|
||||
PluginDescriptor pluginDescriptor =
|
||||
pluginManager.loadPlugin( plugin, session.getCurrentProject().getRemotePluginRepositories(),
|
||||
session.getRepositorySession() );
|
||||
pluginManager.getPluginRealm( session, pluginDescriptor );
|
||||
|
||||
for ( ComponentDescriptor<?> descriptor : pluginDescriptor.getComponents() )
|
||||
{
|
||||
assertNotNull( descriptor.getRealm() );
|
||||
assertNotNull( descriptor.getImplementationClass() );
|
||||
}
|
||||
|
||||
// reload plugin realm from cache
|
||||
session = createMavenSession( getProject( "project-contributing-system-scope-plugin-dep" ) );
|
||||
project = session.getCurrentProject();
|
||||
plugin = project.getPlugin( "org.apache.maven.its.plugins:maven-it-plugin" );
|
||||
|
||||
pluginDescriptor =
|
||||
pluginManager.loadPlugin( plugin, session.getCurrentProject().getRemotePluginRepositories(),
|
||||
session.getRepositorySession() );
|
||||
pluginManager.getPluginRealm( session, pluginDescriptor );
|
||||
|
||||
for ( ComponentDescriptor<?> descriptor : pluginDescriptor.getComponents() )
|
||||
{
|
||||
assertNotNull( descriptor.getRealm() );
|
||||
assertNotNull( descriptor.getImplementationClass() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue