mirror of https://github.com/apache/maven.git
o the component discovery is not exposed outside the plexus core
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@768721 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5d7758b358
commit
755afec417
|
@ -44,7 +44,6 @@ public class DefaultUpdateCheckManager
|
|||
extends AbstractLogEnabled
|
||||
implements UpdateCheckManager
|
||||
{
|
||||
|
||||
public DefaultUpdateCheckManager()
|
||||
{
|
||||
|
||||
|
@ -75,6 +74,8 @@ public class DefaultUpdateCheckManager
|
|||
// release-artifact short circuit above.
|
||||
ArtifactRepositoryPolicy policy = repository.getSnapshots();
|
||||
|
||||
System.out.println( "snappies " + repository.getSnapshots().getUpdatePolicy() );
|
||||
|
||||
return isUpdateRequired( artifact, repository, policy );
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class DefaultWagonManager
|
|||
private ArtifactRepositoryFactory repositoryFactory;
|
||||
|
||||
@Requirement(role = Wagon.class)
|
||||
private Map wagons;
|
||||
private Map<String,Wagon> wagons;
|
||||
|
||||
//@Requirement
|
||||
private CredentialsDataSource credentialsDataSource;
|
||||
|
@ -324,11 +324,6 @@ public class DefaultWagonManager
|
|||
public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferListener downloadMonitor, boolean force )
|
||||
throws TransferFailedException, ResourceDoesNotExistException
|
||||
{
|
||||
if(remoteRepositories == null)
|
||||
{
|
||||
throw new IllegalArgumentException("remoteRepositories: null");
|
||||
}
|
||||
|
||||
for ( ArtifactRepository repository : remoteRepositories )
|
||||
{
|
||||
try
|
||||
|
@ -373,6 +368,10 @@ public class DefaultWagonManager
|
|||
|
||||
ArtifactRepositoryPolicy policy = artifact.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
|
||||
|
||||
boolean updateCheckIsRequired = updateCheckManager.isUpdateRequired( artifact, repository );
|
||||
|
||||
System.out.println( "update check:" + updateCheckIsRequired );
|
||||
|
||||
if ( !policy.isEnabled() )
|
||||
{
|
||||
logger.debug( "Skipping disabled repository " + repository.getId() );
|
||||
|
@ -384,8 +383,10 @@ public class DefaultWagonManager
|
|||
// If the artifact is a snapshot, we need to determine whether it's time to check this repository for an update:
|
||||
// 1. If it's forced, then check
|
||||
// 2. If the updateInterval has been exceeded since the last check for this artifact on this repository, then check.
|
||||
else if ( artifact.isSnapshot() && ( force || updateCheckManager.isUpdateRequired( artifact, repository ) ) )
|
||||
else if ( artifact.isSnapshot() && ( force || updateCheckIsRequired ) )
|
||||
{
|
||||
System.out.println( "!!!!!!!!!!!!!!!!!!!!!");
|
||||
|
||||
logger.debug( "Trying repository " + repository.getId() );
|
||||
|
||||
try
|
||||
|
@ -476,6 +477,8 @@ public class DefaultWagonManager
|
|||
{
|
||||
String protocol = repository.getProtocol();
|
||||
|
||||
System.out.println( wagons );
|
||||
|
||||
Wagon wagon;
|
||||
|
||||
try
|
||||
|
|
|
@ -142,6 +142,8 @@ public class DefaultArtifactResolver
|
|||
}
|
||||
else if ( !artifact.isResolved() )
|
||||
{
|
||||
System.out.println( "looking!" );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Check for the existence of the artifact in the specified local
|
||||
// ArtifactRepository. If it is present then simply return as the
|
||||
|
@ -150,6 +152,7 @@ public class DefaultArtifactResolver
|
|||
|
||||
String localPath = localRepository.pathOf( artifact );
|
||||
|
||||
System.out.println( "3 " + localPath );
|
||||
artifact.setFile( new File( localRepository.getBasedir(), localPath ) );
|
||||
|
||||
transformationManager.transformForResolve( artifact, remoteRepositories, localRepository );
|
||||
|
@ -158,6 +161,9 @@ public class DefaultArtifactResolver
|
|||
|
||||
destination = artifact.getFile();
|
||||
|
||||
System.out.println( "4 " + destination );
|
||||
System.out.println( "5 " + destination.exists() );
|
||||
|
||||
boolean resolved = false;
|
||||
|
||||
// There are three conditions in which we'll go after the artifact here:
|
||||
|
@ -183,6 +189,7 @@ public class DefaultArtifactResolver
|
|||
}
|
||||
else
|
||||
{
|
||||
System.out.println( "trying to get artifact.");
|
||||
wagonManager.getArtifact( artifact, remoteRepositories, downloadMonitor, force );
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public abstract class AbstractArtifactComponentTestCase
|
|||
protected ArtifactRepository badLocalRepository()
|
||||
throws Exception
|
||||
{
|
||||
String path = "target/test-classes/repositories/" + component() + "/bad-local-repository";
|
||||
String path = "target/test-repositories/" + component() + "/bad-local-repository";
|
||||
|
||||
File f = new File( getBasedir(), path );
|
||||
|
||||
|
@ -91,7 +91,7 @@ public abstract class AbstractArtifactComponentTestCase
|
|||
protected ArtifactRepository localRepository()
|
||||
throws Exception
|
||||
{
|
||||
String path = "target/test-classes/repositories/" + component() + "/local-repository";
|
||||
String path = "target/test-repositories/" + component() + "/local-repository";
|
||||
|
||||
File f = new File( getBasedir(), path );
|
||||
|
||||
|
@ -104,7 +104,7 @@ public abstract class AbstractArtifactComponentTestCase
|
|||
protected ArtifactRepository remoteRepository()
|
||||
throws Exception
|
||||
{
|
||||
String path = "target/test-classes/repositories/" + component() + "/remote-repository";
|
||||
String path = "target/test-repositories/" + component() + "/remote-repository";
|
||||
|
||||
File f = new File( getBasedir(), path );
|
||||
|
||||
|
@ -217,6 +217,8 @@ public abstract class AbstractArtifactComponentTestCase
|
|||
{
|
||||
Artifact artifact = createArtifact( artifactId, version );
|
||||
|
||||
System.out.println( "1 " + artifact );
|
||||
|
||||
createArtifact( artifact, remoteRepository() );
|
||||
|
||||
return artifact;
|
||||
|
@ -241,6 +243,8 @@ public abstract class AbstractArtifactComponentTestCase
|
|||
|
||||
File artifactFile = new File( repository.getBasedir(), path );
|
||||
|
||||
System.out.println( "2 " + artifactFile.getParentFile() );
|
||||
|
||||
if ( !artifactFile.getParentFile().exists() )
|
||||
{
|
||||
artifactFile.getParentFile().mkdirs();
|
||||
|
@ -268,7 +272,9 @@ public abstract class AbstractArtifactComponentTestCase
|
|||
protected Artifact createArtifact( String groupId, String artifactId, String version, String type )
|
||||
throws Exception
|
||||
{
|
||||
return artifactFactory.createBuildArtifact( groupId, artifactId, version, type );
|
||||
Artifact a = artifactFactory.createBuildArtifact( groupId, artifactId, version, type );
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
protected void deleteLocalArtifact( Artifact artifact )
|
||||
|
|
|
@ -84,9 +84,7 @@ public class ArtifactResolverTest
|
|||
{
|
||||
Artifact b = createRemoteArtifact( "b", "1.0-SNAPSHOT" );
|
||||
deleteLocalArtifact( b );
|
||||
|
||||
artifactResolver.resolve( b, remoteRepositories(), localRepository() );
|
||||
|
||||
assertLocalArtifactPresent( b );
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,6 @@ under the License.
|
|||
|
||||
<plexus>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.repository.authentication.AuthenticationInfoProvider</role>
|
||||
<implementation>org.apache.maven.artifact.repository.authentication.DummyAuthenticationInfoProvider</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
|
||||
<implementation>org.apache.maven.artifact.deployer.SimpleArtifactMetadataSource</implementation>
|
||||
|
|
|
@ -19,9 +19,5 @@ under the License.
|
|||
|
||||
<plexus>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.repository.authentication.AuthenticationInfoProvider</role>
|
||||
<implementation>org.apache.maven.artifact.repository.authentication.DummyAuthenticationInfoProvider</implementation>
|
||||
</component>
|
||||
</components>
|
||||
</plexus>
|
|
@ -44,9 +44,5 @@ under the License.
|
|||
<role-hint>string</role-hint>
|
||||
<implementation>org.apache.maven.artifact.manager.StringWagon</implementation>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.repository.authentication.AuthenticationInfoProvider</role>
|
||||
<implementation>org.apache.maven.artifact.repository.authentication.DummyAuthenticationInfoProvider</implementation>
|
||||
</component>
|
||||
</components>
|
||||
</plexus>
|
||||
|
|
|
@ -19,9 +19,5 @@ under the License.
|
|||
|
||||
<plexus>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.artifact.repository.authentication.AuthenticationInfoProvider</role>
|
||||
<implementation>org.apache.maven.artifact.repository.authentication.DummyAuthenticationInfoProvider</implementation>
|
||||
</component>
|
||||
</components>
|
||||
</plexus>
|
|
@ -265,8 +265,6 @@ public class DefaultLifecycleExecutor
|
|||
|
||||
for( Plugin plugin : project.getBuild().getPlugins() )
|
||||
{
|
||||
System.out.println( "plugin --> " + plugin );
|
||||
|
||||
for( PluginExecution execution : plugin.getExecutions() )
|
||||
{
|
||||
// if the phase is specified then I don't have to go fetch the plugin yet and pull it down
|
||||
|
|
|
@ -72,7 +72,6 @@ import org.codehaus.plexus.component.configurator.ConfigurationListener;
|
|||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
|
||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
||||
import org.codehaus.plexus.component.discovery.ComponentDiscoverer;
|
||||
import org.codehaus.plexus.component.discovery.ComponentDiscovererManager;
|
||||
import org.codehaus.plexus.component.discovery.ComponentDiscoveryEvent;
|
||||
import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
|
||||
import org.codehaus.plexus.component.repository.ComponentDescriptor;
|
||||
|
@ -132,7 +131,6 @@ public class DefaultPluginManager
|
|||
|
||||
public DefaultPluginManager()
|
||||
{
|
||||
System.out.println( "hello!!!!");
|
||||
pluginDescriptors = new HashMap<String,PluginDescriptor>();
|
||||
}
|
||||
|
||||
|
@ -150,8 +148,6 @@ public class DefaultPluginManager
|
|||
{
|
||||
PluginDescriptor pluginDescriptor = getPluginDescriptor( plugin );
|
||||
|
||||
System.out.println( "XXX plugin: " + plugin );
|
||||
|
||||
// There are cases where plugins are discovered but not actually populated. These are edge cases where you are working in the IDE on
|
||||
// Maven itself so this speaks to a problem we have with the system not starting entirely clean.
|
||||
if ( pluginDescriptor != null && pluginDescriptor.getClassRealm() != null )
|
||||
|
@ -217,8 +213,6 @@ public class DefaultPluginManager
|
|||
|
||||
ClassRealm pluginRealm = container.createChildRealm( pluginKey( plugin ) );
|
||||
|
||||
System.out.println( "plugin: " + pluginArtifact );
|
||||
|
||||
Set<Artifact> pluginArtifacts = getPluginArtifacts( pluginArtifact, plugin, project, session.getLocalRepository() );
|
||||
|
||||
for ( Artifact a : pluginArtifacts )
|
||||
|
@ -589,13 +583,17 @@ public class DefaultPluginManager
|
|||
return mojo;
|
||||
|
||||
}
|
||||
catch ( PlexusConfigurationException e )
|
||||
{
|
||||
throw new PluginConfigurationException( pluginDescriptor, "Error checking parameters: " + e.getMessage() );
|
||||
}
|
||||
finally
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader( oldClassLoader );
|
||||
}
|
||||
}
|
||||
|
||||
private void checkDeprecatedParameters( MojoDescriptor mojoDescriptor, PlexusConfiguration extractedMojoConfiguration )
|
||||
private void checkDeprecatedParameters( MojoDescriptor mojoDescriptor, PlexusConfiguration extractedMojoConfiguration ) throws PlexusConfigurationException
|
||||
{
|
||||
if ( ( extractedMojoConfiguration == null ) || ( extractedMojoConfiguration.getChildCount() < 1 ) )
|
||||
{
|
||||
|
@ -1232,8 +1230,6 @@ public class DefaultPluginManager
|
|||
public List<ComponentSetDescriptor> findComponents( Context context, ClassRealm realm )
|
||||
throws PlexusConfigurationException
|
||||
{
|
||||
System.out.println( "realm: " + realm );
|
||||
|
||||
List<ComponentSetDescriptor> componentSetDescriptors = new ArrayList<ComponentSetDescriptor>();
|
||||
|
||||
Enumeration<URL> resources;
|
||||
|
@ -1284,11 +1280,6 @@ public class DefaultPluginManager
|
|||
}
|
||||
|
||||
componentSetDescriptors.add( componentSetDescriptor );
|
||||
|
||||
// Fire the event
|
||||
ComponentDiscoveryEvent event = new ComponentDiscoveryEvent( componentSetDescriptor );
|
||||
|
||||
componentDiscovererManager.fireComponentDiscoveryEvent( event );
|
||||
}
|
||||
catch ( IOException ex )
|
||||
{
|
||||
|
@ -1303,11 +1294,6 @@ public class DefaultPluginManager
|
|||
return componentSetDescriptors;
|
||||
}
|
||||
|
||||
public void setManager( ComponentDiscovererManager manager )
|
||||
{
|
||||
this.componentDiscovererManager = manager;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Component Discovery Listener
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -1316,8 +1302,6 @@ public class DefaultPluginManager
|
|||
|
||||
private Map pluginIdsByPrefix = new HashMap();
|
||||
|
||||
private ComponentDiscovererManager componentDiscovererManager;
|
||||
|
||||
public void componentDiscovered( ComponentDiscoveryEvent event )
|
||||
{
|
||||
ComponentSetDescriptor componentSetDescriptor = event.getComponentSetDescriptor();
|
||||
|
|
|
@ -20,11 +20,14 @@ import org.apache.maven.model.Plugin;
|
|||
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.discovery.ComponentDiscoverer;
|
||||
import org.codehaus.plexus.component.discovery.ComponentDiscoveryListener;
|
||||
|
||||
/**
|
||||
* @author Jason van Zyl
|
||||
*/
|
||||
public interface PluginManager
|
||||
extends ComponentDiscoverer, ComponentDiscoveryListener
|
||||
{
|
||||
// - find the plugin [extension point: any client may wish to do whatever they choose]
|
||||
// - load the plugin into a classloader [extension point: we want to take them from a repository, some may take from disk or whatever]
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -57,7 +57,7 @@ under the License.
|
|||
<doxiaVersion>1.0-alpha-9</doxiaVersion>
|
||||
<easyMockVersion>1.2_Java1.3</easyMockVersion>
|
||||
<junitVersion>3.8.1</junitVersion>
|
||||
<plexusVersion>1.0-beta-4-SNAPSHOT</plexusVersion>
|
||||
<plexusVersion>1.0-beta-3.0.7-SNAPSHOT</plexusVersion>
|
||||
<plexusInteractivityVersion>1.0-alpha-6</plexusInteractivityVersion>
|
||||
<plexusInterpolationVersion>1.1</plexusInterpolationVersion>
|
||||
<plexusPluginManagerVersion>1.0-alpha-1</plexusPluginManagerVersion>
|
||||
|
|
Loading…
Reference in New Issue