Merge branch 'aether' of github.com:bentmann/maven-3 into eclipse-aether

Conflicts:
	.gitignore
	apache-maven/pom.xml
	maven-aether-provider/pom.xml
	maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
	maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionRangeResolver.java
	maven-aether-provider/src/main/java/org/apache/maven/repository/internal/DefaultVersionResolver.java
	maven-aether-provider/src/main/java/org/apache/maven/repository/internal/LocalSnapshotMetadataGenerator.java
	maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenRepositorySystemSession.java
	maven-aether-provider/src/main/java/org/apache/maven/repository/internal/MavenServiceLocator.java
	maven-aether-provider/src/main/java/org/apache/maven/repository/internal/RemoteSnapshotMetadataGenerator.java
	maven-artifact/pom.xml
	maven-compat/pom.xml
	maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
	maven-compat/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java
	maven-core/pom.xml
	maven-core/src/main/java/org/apache/maven/DefaultMaven.java
	maven-core/src/main/java/org/apache/maven/ReactorReader.java
	maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRealmCache.java
	maven-core/src/main/java/org/apache/maven/project/DefaultProjectDependenciesResolver.java
	maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml
	maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
	maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
	maven-core/src/test/java/org/apache/maven/project/LegacyLocalRepositoryManager.java
	maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
	maven-core/src/test/java/org/apache/maven/repository/TestRepositoryConnector.java
	maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
	maven-embedder/pom.xml
	maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
	maven-model-builder/pom.xml
	maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
	maven-model/pom.xml
	maven-plugin-api/pom.xml
	maven-plugin-api/src/main/mdo/plugin.mdo
	maven-plugin-api/src/site/apt/index.apt
	maven-repository-metadata/pom.xml
	maven-settings-builder/pom.xml
	maven-settings/pom.xml
	pom.xml
	src/site/site.xml
This commit is contained in:
Jason van Zyl 2013-02-14 20:21:50 -05:00
commit 27ad9858d2
130 changed files with 1514 additions and 1746 deletions

3
.gitignore vendored
View File

@ -7,6 +7,9 @@ bin/
# Intellij
*.ipr
*.iml
<<<<<<< HEAD
.idea
=======
>>>>>>> 4fdcdbd26244ff81e242054fd38cf415d92499be
.DS_Store

View File

@ -80,7 +80,7 @@
<artifactId>wagon-file</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-connector-wagon</artifactId>
</dependency>
<dependency>

View File

@ -50,23 +50,23 @@ under the License.
<artifactId>maven-repository-metadata</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-spi</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-util</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-impl</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-connector-wagon</artifactId>
<scope>test</scope>
</dependency>
@ -87,6 +87,19 @@ under the License.
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<classifier>no_aop</classifier>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>

View File

@ -20,10 +20,10 @@ package org.apache.maven.repository.internal;
*/
import org.apache.maven.model.Repository;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.RepositoryPolicy;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.RepositoryPolicy;
/**
* <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
@ -49,11 +49,11 @@ public class ArtifactDescriptorUtils
public static RemoteRepository toRemoteRepository( Repository repository )
{
RemoteRepository result =
new RemoteRepository( repository.getId(), repository.getLayout(), repository.getUrl() );
result.setPolicy( true, toRepositoryPolicy( repository.getSnapshots() ) );
result.setPolicy( false, toRepositoryPolicy( repository.getReleases() ) );
return result;
RemoteRepository.Builder builder =
new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
return builder.build();
}
public static RepositoryPolicy toRepositoryPolicy( org.apache.maven.model.RepositoryPolicy policy )

View File

@ -21,6 +21,7 @@ package org.apache.maven.repository.internal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
@ -28,6 +29,9 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.License;
@ -45,52 +49,55 @@ import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.model.resolution.UnresolvableModelException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.sonatype.aether.RepositoryEvent.EventType;
import org.sonatype.aether.RepositoryException;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.artifact.ArtifactType;
import org.sonatype.aether.artifact.ArtifactTypeRegistry;
import org.sonatype.aether.graph.Dependency;
import org.sonatype.aether.graph.Exclusion;
import org.sonatype.aether.impl.ArtifactDescriptorReader;
import org.sonatype.aether.impl.ArtifactResolver;
import org.sonatype.aether.impl.RemoteRepositoryManager;
import org.sonatype.aether.impl.RepositoryEventDispatcher;
import org.sonatype.aether.impl.VersionResolver;
import org.sonatype.aether.transfer.ArtifactNotFoundException;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.artifact.ArtifactProperties;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.DefaultArtifactType;
import org.sonatype.aether.util.listener.DefaultRepositoryEvent;
import org.sonatype.aether.repository.WorkspaceRepository;
import org.sonatype.aether.resolution.ArtifactDescriptorException;
import org.sonatype.aether.resolution.ArtifactDescriptorRequest;
import org.sonatype.aether.resolution.ArtifactDescriptorResult;
import org.sonatype.aether.resolution.ArtifactRequest;
import org.sonatype.aether.resolution.ArtifactResolutionException;
import org.sonatype.aether.resolution.ArtifactResult;
import org.sonatype.aether.resolution.VersionRequest;
import org.sonatype.aether.resolution.VersionResolutionException;
import org.sonatype.aether.resolution.VersionResult;
import org.sonatype.aether.spi.locator.Service;
import org.sonatype.aether.spi.locator.ServiceLocator;
import org.sonatype.aether.spi.log.Logger;
import org.sonatype.aether.spi.log.NullLogger;
import org.eclipse.aether.RepositoryException;
import org.eclipse.aether.RepositoryEvent.EventType;
import org.eclipse.aether.RepositoryEvent;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.ArtifactProperties;
import org.eclipse.aether.artifact.ArtifactType;
import org.eclipse.aether.artifact.ArtifactTypeRegistry;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.artifact.DefaultArtifactType;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.Exclusion;
import org.eclipse.aether.impl.ArtifactDescriptorReader;
import org.eclipse.aether.impl.ArtifactResolver;
import org.eclipse.aether.impl.RemoteRepositoryManager;
import org.eclipse.aether.impl.RepositoryEventDispatcher;
import org.eclipse.aether.impl.VersionResolver;
import org.eclipse.aether.repository.WorkspaceRepository;
import org.eclipse.aether.resolution.ArtifactDescriptorException;
import org.eclipse.aether.resolution.ArtifactDescriptorPolicy;
import org.eclipse.aether.resolution.ArtifactDescriptorPolicyRequest;
import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
import org.eclipse.aether.resolution.ArtifactDescriptorResult;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.resolution.VersionRequest;
import org.eclipse.aether.resolution.VersionResolutionException;
import org.eclipse.aether.resolution.VersionResult;
import org.eclipse.aether.spi.locator.Service;
import org.eclipse.aether.spi.locator.ServiceLocator;
import org.eclipse.aether.spi.log.Logger;
import org.eclipse.aether.spi.log.LoggerFactory;
import org.eclipse.aether.spi.log.NullLoggerFactory;
import org.eclipse.aether.transfer.ArtifactNotFoundException;
/**
* @author Benjamin Bentmann
*/
@Named
@Component( role = ArtifactDescriptorReader.class )
public class DefaultArtifactDescriptorReader
implements ArtifactDescriptorReader, Service
{
@SuppressWarnings( "unused" )
@Requirement
private Logger logger = NullLogger.INSTANCE;
@Requirement( role = LoggerFactory.class )
private Logger logger = NullLoggerFactory.LOGGER;
@Requirement
private RemoteRepositoryManager remoteRepositoryManager;
@ -107,9 +114,27 @@ public class DefaultArtifactDescriptorReader
@Requirement
private ModelBuilder modelBuilder;
public DefaultArtifactDescriptorReader()
{
// enable no-arg constructor
}
@Inject
DefaultArtifactDescriptorReader( RemoteRepositoryManager remoteRepositoryManager, VersionResolver versionResolver,
ArtifactResolver artifactResolver, ModelBuilder modelBuilder,
RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
{
setRemoteRepositoryManager( remoteRepositoryManager );
setVersionResolver( versionResolver );
setArtifactResolver( artifactResolver );
setModelBuilder( modelBuilder );
setLoggerFactory( loggerFactory );
setRepositoryEventDispatcher( repositoryEventDispatcher );
}
public void initService( ServiceLocator locator )
{
setLogger( locator.getService( Logger.class ) );
setLoggerFactory( locator.getService( LoggerFactory.class ) );
setRemoteRepositoryManager( locator.getService( RemoteRepositoryManager.class ) );
setVersionResolver( locator.getService( VersionResolver.class ) );
setArtifactResolver( locator.getService( ArtifactResolver.class ) );
@ -121,12 +146,18 @@ public class DefaultArtifactDescriptorReader
}
}
public DefaultArtifactDescriptorReader setLogger( Logger logger )
public DefaultArtifactDescriptorReader setLoggerFactory( LoggerFactory loggerFactory )
{
this.logger = ( logger != null ) ? logger : NullLogger.INSTANCE;
this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
return this;
}
void setLogger( LoggerFactory loggerFactory )
{
// plexus support
setLoggerFactory( loggerFactory );
}
public DefaultArtifactDescriptorReader setRemoteRepositoryManager( RemoteRepositoryManager remoteRepositoryManager )
{
if ( remoteRepositoryManager == null )
@ -228,6 +259,8 @@ public class DefaultArtifactDescriptorReader
}
result.setProperties( properties );
setArtifactProperties( result, model );
}
return result;
@ -237,7 +270,7 @@ public class DefaultArtifactDescriptorReader
ArtifactDescriptorResult result )
throws ArtifactDescriptorException
{
RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request );
RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
Set<String> visited = new LinkedHashSet<String>();
for ( Artifact artifact = request.getArtifact();; )
@ -262,7 +295,7 @@ public class DefaultArtifactDescriptorReader
RepositoryException exception =
new RepositoryException( "Artifact relocations form a cycle: " + visited );
invalidDescriptor( session, trace, artifact, exception );
if ( session.isIgnoreInvalidArtifactDescriptor() )
if ( ( getPolicy( session, artifact, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
{
return null;
}
@ -287,7 +320,7 @@ public class DefaultArtifactDescriptorReader
if ( e.getCause() instanceof ArtifactNotFoundException )
{
missingDescriptor( session, trace, artifact, (Exception) e.getCause() );
if ( session.isIgnoreMissingArtifactDescriptor() )
if ( ( getPolicy( session, artifact, request ) & ArtifactDescriptorPolicy.IGNORE_MISSING ) != 0 )
{
return null;
}
@ -332,7 +365,7 @@ public class DefaultArtifactDescriptorReader
}
}
invalidDescriptor( session, trace, artifact, e );
if ( session.isIgnoreInvalidArtifactDescriptor() )
if ( ( getPolicy( session, artifact, request ) & ArtifactDescriptorPolicy.IGNORE_INVALID ) != 0 )
{
return null;
}
@ -382,6 +415,23 @@ public class DefaultArtifactDescriptorReader
return relocation;
}
private void setArtifactProperties( ArtifactDescriptorResult result, Model model )
{
String downloadUrl = null;
DistributionManagement distMngt = model.getDistributionManagement();
if ( distMngt != null )
{
downloadUrl = distMngt.getDownloadUrl();
}
if ( downloadUrl != null && downloadUrl.length() > 0 )
{
Artifact artifact = result.getArtifact();
Map<String, String> props = new HashMap<String, String>( artifact.getProperties() );
props.put( ArtifactProperties.DOWNLOAD_URL, downloadUrl );
result.setArtifact( artifact.setProperties( props ) );
}
}
private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes )
{
ArtifactType stereotype = stereotypes.get( dependency.getType() );
@ -421,23 +471,33 @@ public class DefaultArtifactDescriptorReader
private void missingDescriptor( RepositorySystemSession session, RequestTrace trace, Artifact artifact,
Exception exception )
{
DefaultRepositoryEvent event =
new DefaultRepositoryEvent( EventType.ARTIFACT_DESCRIPTOR_MISSING, session, trace );
RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.ARTIFACT_DESCRIPTOR_MISSING );
event.setTrace( trace );
event.setArtifact( artifact );
event.setException( exception );
repositoryEventDispatcher.dispatch( event );
repositoryEventDispatcher.dispatch( event.build() );
}
private void invalidDescriptor( RepositorySystemSession session, RequestTrace trace, Artifact artifact,
Exception exception )
{
DefaultRepositoryEvent event =
new DefaultRepositoryEvent( EventType.ARTIFACT_DESCRIPTOR_INVALID, session, trace );
RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.ARTIFACT_DESCRIPTOR_INVALID );
event.setTrace( trace );
event.setArtifact( artifact );
event.setException( exception );
repositoryEventDispatcher.dispatch( event );
repositoryEventDispatcher.dispatch( event.build() );
}
private int getPolicy( RepositorySystemSession session, Artifact artifact, ArtifactDescriptorRequest request )
{
ArtifactDescriptorPolicy policy = session.getArtifactDescriptorPolicy();
if ( policy == null )
{
return ArtifactDescriptorPolicy.STRICT;
}
return policy.getPolicy( session, new ArtifactDescriptorPolicyRequest( artifact, request.getRequestContext() ) );
}
}

View File

@ -20,8 +20,8 @@ package org.apache.maven.repository.internal;
*/
import org.apache.maven.model.building.ModelCache;
import org.sonatype.aether.RepositoryCache;
import org.sonatype.aether.RepositorySystemSession;
import org.eclipse.aether.RepositoryCache;
import org.eclipse.aether.RepositorySystemSession;
/**
* A model builder cache backed by the repository system cache.

View File

@ -31,15 +31,15 @@ import org.apache.maven.model.building.ModelSource;
import org.apache.maven.model.resolution.InvalidRepositoryException;
import org.apache.maven.model.resolution.ModelResolver;
import org.apache.maven.model.resolution.UnresolvableModelException;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.impl.ArtifactResolver;
import org.sonatype.aether.impl.RemoteRepositoryManager;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.resolution.ArtifactRequest;
import org.sonatype.aether.resolution.ArtifactResolutionException;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.impl.ArtifactResolver;
import org.eclipse.aether.impl.RemoteRepositoryManager;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
/**
* A model resolver to assist building of dependency POMs. This resolver gives priority to those repositories that have
@ -93,7 +93,7 @@ class DefaultModelResolver
public void addRepository( Repository repository )
throws InvalidRepositoryException
{
if ( !repositoryIds.add( repository.getId() ) )
if ( session.isIgnoreArtifactDescriptorRepositories() || !repositoryIds.add( repository.getId() ) )
{
return;
}

View File

@ -1,52 +0,0 @@
package org.apache.maven.repository.internal;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.sonatype.aether.impl.ArtifactDescriptorReader;
import org.sonatype.aether.impl.MetadataGeneratorFactory;
import org.sonatype.aether.impl.VersionRangeResolver;
import org.sonatype.aether.impl.VersionResolver;
/**
* A simple service locator that is already setup with all components from this library. To acquire a complete
* repository system, clients need to add some repository connectors for remote transfers. <em>Note:</em> This component
* is meant to assists those clients that employ the repository systems outside of an IoC container, Maven plugins
* should instead always use regular dependency injection to acquire the repository system.
*
* @author Benjamin Bentmann
* @deprecated use {@link MavenServiceLocator} instead, which is more explicit.
*/
public class DefaultServiceLocator
extends org.sonatype.aether.impl.internal.DefaultServiceLocator
{
/**
* Creates a new service locator that already knows about all service implementations included this library.
*/
public DefaultServiceLocator()
{
addService( ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class );
addService( VersionResolver.class, DefaultVersionResolver.class );
addService( VersionRangeResolver.class, DefaultVersionRangeResolver.class );
addService( MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class );
addService( MetadataGeneratorFactory.class, VersionsMetadataGeneratorFactory.class );
}
}

View File

@ -26,44 +26,48 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.util.IOUtil;
import org.sonatype.aether.RepositoryEvent.EventType;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.SyncContext;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.listener.DefaultRepositoryEvent;
import org.sonatype.aether.util.metadata.DefaultMetadata;
import org.sonatype.aether.util.version.GenericVersionScheme;
import org.sonatype.aether.version.InvalidVersionSpecificationException;
import org.sonatype.aether.version.Version;
import org.sonatype.aether.version.VersionConstraint;
import org.sonatype.aether.version.VersionScheme;
import org.sonatype.aether.impl.MetadataResolver;
import org.sonatype.aether.impl.RepositoryEventDispatcher;
import org.sonatype.aether.impl.SyncContextFactory;
import org.sonatype.aether.impl.VersionRangeResolver;
import org.sonatype.aether.metadata.Metadata;
import org.sonatype.aether.repository.ArtifactRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.resolution.MetadataRequest;
import org.sonatype.aether.resolution.MetadataResult;
import org.sonatype.aether.resolution.VersionRangeRequest;
import org.sonatype.aether.resolution.VersionRangeResolutionException;
import org.sonatype.aether.resolution.VersionRangeResult;
import org.sonatype.aether.spi.locator.Service;
import org.sonatype.aether.spi.locator.ServiceLocator;
import org.sonatype.aether.spi.log.Logger;
import org.sonatype.aether.spi.log.NullLogger;
import org.eclipse.aether.RepositoryEvent.EventType;
import org.eclipse.aether.RepositoryEvent;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.SyncContext;
import org.eclipse.aether.impl.MetadataResolver;
import org.eclipse.aether.impl.RepositoryEventDispatcher;
import org.eclipse.aether.impl.SyncContextFactory;
import org.eclipse.aether.impl.VersionRangeResolver;
import org.eclipse.aether.metadata.DefaultMetadata;
import org.eclipse.aether.metadata.Metadata;
import org.eclipse.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.resolution.MetadataRequest;
import org.eclipse.aether.resolution.MetadataResult;
import org.eclipse.aether.resolution.VersionRangeRequest;
import org.eclipse.aether.resolution.VersionRangeResolutionException;
import org.eclipse.aether.resolution.VersionRangeResult;
import org.eclipse.aether.spi.locator.Service;
import org.eclipse.aether.spi.locator.ServiceLocator;
import org.eclipse.aether.spi.log.Logger;
import org.eclipse.aether.spi.log.LoggerFactory;
import org.eclipse.aether.spi.log.NullLoggerFactory;
import org.eclipse.aether.util.version.GenericVersionScheme;
import org.eclipse.aether.version.InvalidVersionSpecificationException;
import org.eclipse.aether.version.Version;
import org.eclipse.aether.version.VersionConstraint;
import org.eclipse.aether.version.VersionScheme;
/**
* @author Benjamin Bentmann
*/
@Named
@Component( role = VersionRangeResolver.class )
public class DefaultVersionRangeResolver
implements VersionRangeResolver, Service
@ -72,8 +76,8 @@ public class DefaultVersionRangeResolver
private static final String MAVEN_METADATA_XML = "maven-metadata.xml";
@SuppressWarnings( "unused" )
@Requirement
private Logger logger = NullLogger.INSTANCE;
@Requirement( role = LoggerFactory.class )
private Logger logger = NullLoggerFactory.LOGGER;
@Requirement
private MetadataResolver metadataResolver;
@ -84,20 +88,41 @@ public class DefaultVersionRangeResolver
@Requirement
private RepositoryEventDispatcher repositoryEventDispatcher;
public DefaultVersionRangeResolver()
{
// enable default constructor
}
@Inject
DefaultVersionRangeResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
{
setMetadataResolver( metadataResolver );
setSyncContextFactory( syncContextFactory );
setLoggerFactory( loggerFactory );
setRepositoryEventDispatcher( repositoryEventDispatcher );
}
public void initService( ServiceLocator locator )
{
setLogger( locator.getService( Logger.class ) );
setLoggerFactory( locator.getService( LoggerFactory.class ) );
setMetadataResolver( locator.getService( MetadataResolver.class ) );
setSyncContextFactory( locator.getService( SyncContextFactory.class ) );
setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
}
public DefaultVersionRangeResolver setLogger( Logger logger )
public DefaultVersionRangeResolver setLoggerFactory( LoggerFactory loggerFactory )
{
this.logger = ( logger != null ) ? logger : NullLogger.INSTANCE;
this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
return this;
}
void setLogger( LoggerFactory loggerFactory )
{
// plexus support
setLoggerFactory( loggerFactory );
}
public DefaultVersionRangeResolver setMetadataResolver( MetadataResolver metadataResolver )
{
if ( metadataResolver == null )
@ -148,7 +173,7 @@ public class DefaultVersionRangeResolver
result.setVersionConstraint( versionConstraint );
if ( versionConstraint.getRanges().isEmpty() )
if ( versionConstraint.getRange() == null )
{
result.addVersion( versionConstraint.getVersion() );
}
@ -184,7 +209,7 @@ public class DefaultVersionRangeResolver
private Map<String, ArtifactRepository> getVersions( RepositorySystemSession session, VersionRangeResult result,
VersionRangeRequest request )
{
RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request );
RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
Map<String, ArtifactRepository> versionIndex = new HashMap<String, ArtifactRepository>();
@ -265,7 +290,7 @@ public class DefaultVersionRangeResolver
}
finally
{
syncContext.release();
syncContext.close();
}
}
}
@ -285,12 +310,13 @@ public class DefaultVersionRangeResolver
private void invalidMetadata( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
ArtifactRepository repository, Exception exception )
{
DefaultRepositoryEvent event = new DefaultRepositoryEvent( EventType.METADATA_INVALID, session, trace );
RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
event.setTrace( trace );
event.setMetadata( metadata );
event.setException( exception );
event.setRepository( repository );
repositoryEventDispatcher.dispatch( event );
repositoryEventDispatcher.dispatch( event.build() );
}
}

View File

@ -28,6 +28,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.maven.artifact.repository.metadata.Snapshot;
import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
import org.apache.maven.artifact.repository.metadata.Versioning;
@ -36,40 +39,41 @@ import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.aether.RepositoryCache;
import org.sonatype.aether.RepositoryEvent.EventType;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.SyncContext;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.impl.MetadataResolver;
import org.sonatype.aether.impl.RepositoryEventDispatcher;
import org.sonatype.aether.impl.SyncContextFactory;
import org.sonatype.aether.impl.VersionResolver;
import org.sonatype.aether.impl.internal.CacheUtils;
import org.sonatype.aether.metadata.Metadata;
import org.sonatype.aether.repository.ArtifactRepository;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.repository.WorkspaceRepository;
import org.sonatype.aether.resolution.MetadataRequest;
import org.sonatype.aether.resolution.MetadataResult;
import org.sonatype.aether.resolution.VersionRequest;
import org.sonatype.aether.resolution.VersionResolutionException;
import org.sonatype.aether.resolution.VersionResult;
import org.sonatype.aether.spi.locator.Service;
import org.sonatype.aether.spi.locator.ServiceLocator;
import org.sonatype.aether.spi.log.Logger;
import org.sonatype.aether.spi.log.NullLogger;
import org.sonatype.aether.util.ConfigUtils;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.listener.DefaultRepositoryEvent;
import org.sonatype.aether.util.metadata.DefaultMetadata;
import org.eclipse.aether.RepositoryCache;
import org.eclipse.aether.RepositoryEvent.EventType;
import org.eclipse.aether.RepositoryEvent;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.SyncContext;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.impl.MetadataResolver;
import org.eclipse.aether.impl.RepositoryEventDispatcher;
import org.eclipse.aether.impl.SyncContextFactory;
import org.eclipse.aether.impl.VersionResolver;
import org.eclipse.aether.internal.impl.CacheUtils;
import org.eclipse.aether.metadata.DefaultMetadata;
import org.eclipse.aether.metadata.Metadata;
import org.eclipse.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.repository.WorkspaceRepository;
import org.eclipse.aether.resolution.MetadataRequest;
import org.eclipse.aether.resolution.MetadataResult;
import org.eclipse.aether.resolution.VersionRequest;
import org.eclipse.aether.resolution.VersionResolutionException;
import org.eclipse.aether.resolution.VersionResult;
import org.eclipse.aether.spi.locator.Service;
import org.eclipse.aether.spi.locator.ServiceLocator;
import org.eclipse.aether.spi.log.Logger;
import org.eclipse.aether.spi.log.LoggerFactory;
import org.eclipse.aether.spi.log.NullLoggerFactory;
import org.eclipse.aether.util.ConfigUtils;
/**
* @author Benjamin Bentmann
*/
@Named
@Component( role = VersionResolver.class )
public class DefaultVersionResolver
implements VersionResolver, Service
@ -84,8 +88,8 @@ public class DefaultVersionResolver
private static final String SNAPSHOT = "SNAPSHOT";
@SuppressWarnings( "unused" )
@Requirement
private Logger logger = NullLogger.INSTANCE;
@Requirement( role = LoggerFactory.class )
private Logger logger = NullLoggerFactory.LOGGER;
@Requirement
private MetadataResolver metadataResolver;
@ -96,20 +100,41 @@ public class DefaultVersionResolver
@Requirement
private RepositoryEventDispatcher repositoryEventDispatcher;
public DefaultVersionResolver()
{
// enable no-arg constructor
}
@Inject
DefaultVersionResolver( MetadataResolver metadataResolver, SyncContextFactory syncContextFactory,
RepositoryEventDispatcher repositoryEventDispatcher, LoggerFactory loggerFactory )
{
setMetadataResolver( metadataResolver );
setSyncContextFactory( syncContextFactory );
setLoggerFactory( loggerFactory );
setRepositoryEventDispatcher( repositoryEventDispatcher );
}
public void initService( ServiceLocator locator )
{
setLogger( locator.getService( Logger.class ) );
setLoggerFactory( locator.getService( LoggerFactory.class ) );
setMetadataResolver( locator.getService( MetadataResolver.class ) );
setSyncContextFactory( locator.getService( SyncContextFactory.class ) );
setRepositoryEventDispatcher( locator.getService( RepositoryEventDispatcher.class ) );
}
public DefaultVersionResolver setLogger( Logger logger )
public DefaultVersionResolver setLoggerFactory( LoggerFactory loggerFactory )
{
this.logger = ( logger != null ) ? logger : NullLogger.INSTANCE;
this.logger = NullLoggerFactory.getSafeLogger( loggerFactory, getClass() );
return this;
}
void setLogger( LoggerFactory loggerFactory )
{
// plexus support
setLoggerFactory( loggerFactory );
}
public DefaultVersionResolver setMetadataResolver( MetadataResolver metadataResolver )
{
if ( metadataResolver == null )
@ -143,7 +168,7 @@ public class DefaultVersionResolver
public VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request )
throws VersionResolutionException
{
RequestTrace trace = DefaultRequestTrace.newChild( request.getTrace(), request );
RequestTrace trace = RequestTrace.newChild( request.getTrace(), request );
Artifact artifact = request.getArtifact();
@ -153,7 +178,6 @@ public class DefaultVersionResolver
Key cacheKey = null;
RepositoryCache cache = session.getCache();
if ( cache != null && !ConfigUtils.getBoolean( session, false, "aether.versionResolver.noCache" ) )
{
cacheKey = new Key( session, request );
@ -356,7 +380,7 @@ public class DefaultVersionResolver
}
finally
{
syncContext.release();
syncContext.close();
}
}
}
@ -376,12 +400,13 @@ public class DefaultVersionResolver
private void invalidMetadata( RepositorySystemSession session, RequestTrace trace, Metadata metadata,
ArtifactRepository repository, Exception exception )
{
DefaultRepositoryEvent event = new DefaultRepositoryEvent( EventType.METADATA_INVALID, session, trace );
RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
event.setTrace( trace );
event.setMetadata( metadata );
event.setException( exception );
event.setRepository( repository );
repositoryEventDispatcher.dispatch( event );
repositoryEventDispatcher.dispatch( event.build() );
}
private void merge( Artifact artifact, Map<String, VersionInfo> infos, Versioning versioning,

View File

@ -29,7 +29,7 @@ import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.Snapshot;
import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.sonatype.aether.artifact.Artifact;
import org.eclipse.aether.artifact.Artifact;
/**
* @author Benjamin Bentmann

View File

@ -24,12 +24,12 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.impl.MetadataGenerator;
import org.sonatype.aether.installation.InstallRequest;
import org.sonatype.aether.metadata.Metadata;
import org.sonatype.aether.util.ConfigUtils;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.impl.MetadataGenerator;
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.metadata.Metadata;
import org.eclipse.aether.util.ConfigUtils;
/**
* @author Benjamin Bentmann

View File

@ -0,0 +1,55 @@
package org.apache.maven.repository.internal;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.inject.Named;
import javax.inject.Singleton;
import org.apache.maven.model.building.DefaultModelBuilderFactory;
import org.apache.maven.model.building.ModelBuilder;
import org.eclipse.aether.impl.AetherModule;
import org.eclipse.aether.impl.ArtifactDescriptorReader;
import org.eclipse.aether.impl.MetadataGeneratorFactory;
import org.eclipse.aether.impl.VersionRangeResolver;
import org.eclipse.aether.impl.VersionResolver;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.name.Names;
public final class MavenAetherModule
extends AbstractModule
{
@Override
protected void configure()
{
install( new AetherModule() );
bind( ArtifactDescriptorReader.class ) //
.to( DefaultArtifactDescriptorReader.class ).in( Singleton.class );
bind( VersionResolver.class ) //
.to( DefaultVersionResolver.class ).in( Singleton.class );
bind( VersionRangeResolver.class ) //
.to( DefaultVersionRangeResolver.class ).in( Singleton.class );
bind( MetadataGeneratorFactory.class ).annotatedWith( Names.named( "snapshot" ) ) //
.to( SnapshotMetadataGeneratorFactory.class ).in( Singleton.class );
bind( MetadataGeneratorFactory.class ).annotatedWith( Names.named( "versions" ) ) //
.to( VersionsMetadataGeneratorFactory.class ).in( Singleton.class );
bind( ModelBuilder.class ) //
.toInstance( new DefaultModelBuilderFactory().newInstance() );
}
@Provides
@Singleton
Set<MetadataGeneratorFactory> provideMetadataGeneratorFactories( @Named( "snapshot" ) MetadataGeneratorFactory snapshot,
@Named( "versions" ) MetadataGeneratorFactory versions )
{
Set<MetadataGeneratorFactory> factories = new HashSet<MetadataGeneratorFactory>();
factories.add( snapshot );
factories.add( versions );
return Collections.unmodifiableSet( factories );
}
}

View File

@ -23,6 +23,8 @@ import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.util.Collections;
import java.util.Map;
import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
@ -31,13 +33,15 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.sonatype.aether.RepositoryException;
import org.sonatype.aether.metadata.MergeableMetadata;
import org.eclipse.aether.RepositoryException;
import org.eclipse.aether.metadata.AbstractMetadata;
import org.eclipse.aether.metadata.MergeableMetadata;
/**
* @author Benjamin Bentmann
*/
abstract class MavenMetadata
extends AbstractMetadata
implements MergeableMetadata
{
@ -130,24 +134,15 @@ abstract class MavenMetadata
}
}
@Override
public String toString()
public Map<String, String> getProperties()
{
StringBuilder buffer = new StringBuilder( 128 );
if ( getGroupId().length() > 0 )
{
buffer.append( getGroupId() );
}
if ( getArtifactId().length() > 0 )
{
buffer.append( ':' ).append( getArtifactId() );
}
if ( getVersion().length() > 0 )
{
buffer.append( ':' ).append( getVersion() );
}
buffer.append( '/' ).append( getType() );
return buffer.toString();
return Collections.emptyMap();
}
@Override
public org.eclipse.aether.metadata.Metadata setProperties( Map<String, String> properties )
{
return this;
}
}

View File

@ -1,119 +0,0 @@
package org.apache.maven.repository.internal;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.sonatype.aether.collection.DependencyGraphTransformer;
import org.sonatype.aether.collection.DependencyManager;
import org.sonatype.aether.collection.DependencySelector;
import org.sonatype.aether.collection.DependencyTraverser;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
import org.sonatype.aether.util.artifact.DefaultArtifactType;
import org.sonatype.aether.util.artifact.DefaultArtifactTypeRegistry;
import org.sonatype.aether.util.graph.manager.ClassicDependencyManager;
import org.sonatype.aether.util.graph.selector.AndDependencySelector;
import org.sonatype.aether.util.graph.selector.ExclusionDependencySelector;
import org.sonatype.aether.util.graph.selector.OptionalDependencySelector;
import org.sonatype.aether.util.graph.selector.ScopeDependencySelector;
import org.sonatype.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
import org.sonatype.aether.util.graph.transformer.ConflictMarker;
import org.sonatype.aether.util.graph.transformer.JavaDependencyContextRefiner;
import org.sonatype.aether.util.graph.transformer.JavaEffectiveScopeCalculator;
import org.sonatype.aether.util.graph.transformer.NearestVersionConflictResolver;
import org.sonatype.aether.util.graph.traverser.FatArtifactTraverser;
import org.sonatype.aether.util.repository.DefaultAuthenticationSelector;
import org.sonatype.aether.util.repository.DefaultMirrorSelector;
import org.sonatype.aether.util.repository.DefaultProxySelector;
/**
* The base Maven repository system session, without environment configuration (authentication, mirror,
* proxy, ...).
*
* <p><strong>Warning:</strong> This class is not intended for
* usage by Maven plugins, those should always acquire the current repository system session via
* <a href="/ref/current/maven-core/apidocs/org/apache/maven/plugin/PluginParameterExpressionEvaluator.html">plugin
* parameter injection</a>, since the current repository system session is created by Maven in
* <a href="/ref/current/maven-core/apidocs/org/apache/maven/DefaultMaven.html">
* <code>DefaultMaven.newRepositorySession(MavenExecutionRequest request)</code></a>.</p>
*
* @author Benjamin Bentmann
*/
public class MavenRepositorySystemSession
extends DefaultRepositorySystemSession
{
/**
* Creates a new Maven repository system session by initializing the session with values typical for
* Maven-based resolution. In more detail, this constructor configures settings relevant for the processing of
* dependency graphs, most other settings remain at their generic default value. Use the various setters to further
* configure the session with authentication, mirror, proxy and other information required for your environment.
*
* @param standalone is this instance expected to be used inside Maven, with Plexus and Maven core components, or
* standalone? If standalone, System properties are used and classical Maven artifact handlers are pre-configured
* to mimic complete Maven repository system session.
*/
public MavenRepositorySystemSession( boolean standalone )
{
DependencyTraverser depTraverser = new FatArtifactTraverser();
setDependencyTraverser( depTraverser );
DependencyManager depManager = new ClassicDependencyManager();
setDependencyManager( depManager );
DependencySelector depFilter =
new AndDependencySelector( new ScopeDependencySelector( "test", "provided" ),
new OptionalDependencySelector(), new ExclusionDependencySelector() );
setDependencySelector( depFilter );
DependencyGraphTransformer transformer =
new ChainedDependencyGraphTransformer( new ConflictMarker(), new JavaEffectiveScopeCalculator(),
new NearestVersionConflictResolver(),
new JavaDependencyContextRefiner() );
setDependencyGraphTransformer( transformer );
setIgnoreInvalidArtifactDescriptor( true );
setIgnoreMissingArtifactDescriptor( true );
if ( standalone )
{
setMirrorSelector( new DefaultMirrorSelector() );
setAuthenticationSelector( new DefaultAuthenticationSelector() );
setProxySelector( new DefaultProxySelector() );
DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
stereotypes.add( new DefaultArtifactType( "pom" ) );
stereotypes.add( new DefaultArtifactType( "maven-plugin", "jar", "", "java" ) );
stereotypes.add( new DefaultArtifactType( "jar", "jar", "", "java" ) );
stereotypes.add( new DefaultArtifactType( "ejb", "jar", "", "java" ) );
stereotypes.add( new DefaultArtifactType( "ejb-client", "jar", "client", "java" ) );
stereotypes.add( new DefaultArtifactType( "test-jar", "jar", "tests", "java" ) );
stereotypes.add( new DefaultArtifactType( "javadoc", "jar", "javadoc", "java" ) );
stereotypes.add( new DefaultArtifactType( "java-source", "jar", "sources", "java", false, false ) );
stereotypes.add( new DefaultArtifactType( "war", "war", "", "java", false, true ) );
stereotypes.add( new DefaultArtifactType( "ear", "ear", "", "java", false, true ) );
stereotypes.add( new DefaultArtifactType( "rar", "rar", "", "java", false, true ) );
stereotypes.add( new DefaultArtifactType( "par", "par", "", "java", false, true ) );
setArtifactTypeRegistry( stereotypes );
setSystemProps( System.getProperties() );
setConfigProps( System.getProperties() );
}
}
}

View File

@ -0,0 +1,136 @@
package org.apache.maven.repository.internal;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.Properties;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.artifact.DefaultArtifactType;
import org.eclipse.aether.collection.DependencyGraphTransformer;
import org.eclipse.aether.collection.DependencyManager;
import org.eclipse.aether.collection.DependencySelector;
import org.eclipse.aether.collection.DependencyTraverser;
import org.eclipse.aether.impl.ArtifactDescriptorReader;
import org.eclipse.aether.impl.DefaultServiceLocator;
import org.eclipse.aether.impl.MetadataGeneratorFactory;
import org.eclipse.aether.impl.VersionRangeResolver;
import org.eclipse.aether.impl.VersionResolver;
import org.eclipse.aether.util.artifact.DefaultArtifactTypeRegistry;
import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
import org.eclipse.aether.util.graph.selector.AndDependencySelector;
import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector;
import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
import org.eclipse.aether.util.graph.selector.ScopeDependencySelector;
import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
import org.eclipse.aether.util.graph.transformer.ConflictResolver;
import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
import org.eclipse.aether.util.graph.transformer.JavaScopeSelector;
import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
/**
* A utility class to assist in setting up a Maven-like repository system. <em>Note:</em> This component is meant to
* assist those clients that employ the repository system outside of an IoC container, Maven plugins should instead
* always use regular dependency injection to acquire the repository system.
*
* @author Benjamin Bentmann
*/
public final class MavenRepositorySystemUtils
{
private MavenRepositorySystemUtils()
{
// hide constructor
}
/**
* Creates a new service locator that already knows about all service implementations included in this library. To
* acquire a complete repository system, clients need to add some repository connectors for remote transfers.
*
* @return The new service locator, never {@code null}.
*/
public static DefaultServiceLocator newServiceLocator()
{
DefaultServiceLocator locator = new DefaultServiceLocator();
locator.addService( ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class );
locator.addService( VersionResolver.class, DefaultVersionResolver.class );
locator.addService( VersionRangeResolver.class, DefaultVersionRangeResolver.class );
locator.addService( MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class );
locator.addService( MetadataGeneratorFactory.class, VersionsMetadataGeneratorFactory.class );
return locator;
}
/**
* Creates a new Maven-like repository system session by initializing the session with values typical for
* Maven-based resolution. In more detail, this method configures settings relevant for the processing of dependency
* graphs, most other settings remain at their generic default value. Use the various setters to further configure
* the session with authentication, mirror, proxy and other information required for your environment.
*
* @return The new repository system session, never {@code null}.
*/
public static DefaultRepositorySystemSession newSession()
{
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
DependencyTraverser depTraverser = new FatArtifactTraverser();
session.setDependencyTraverser( depTraverser );
DependencyManager depManager = new ClassicDependencyManager();
session.setDependencyManager( depManager );
DependencySelector depFilter =
new AndDependencySelector( new ScopeDependencySelector( "test", "provided" ),
new OptionalDependencySelector(), new ExclusionDependencySelector() );
session.setDependencySelector( depFilter );
DependencyGraphTransformer transformer =
new ConflictResolver( new NearestVersionSelector(), new JavaScopeSelector(),
new SimpleOptionalitySelector(), new JavaScopeDeriver() );
new ChainedDependencyGraphTransformer( transformer, new JavaDependencyContextRefiner() );
session.setDependencyGraphTransformer( transformer );
DefaultArtifactTypeRegistry stereotypes = new DefaultArtifactTypeRegistry();
stereotypes.add( new DefaultArtifactType( "pom" ) );
stereotypes.add( new DefaultArtifactType( "maven-plugin", "jar", "", "java" ) );
stereotypes.add( new DefaultArtifactType( "jar", "jar", "", "java" ) );
stereotypes.add( new DefaultArtifactType( "ejb", "jar", "", "java" ) );
stereotypes.add( new DefaultArtifactType( "ejb-client", "jar", "client", "java" ) );
stereotypes.add( new DefaultArtifactType( "test-jar", "jar", "tests", "java" ) );
stereotypes.add( new DefaultArtifactType( "javadoc", "jar", "javadoc", "java" ) );
stereotypes.add( new DefaultArtifactType( "java-source", "jar", "sources", "java", false, false ) );
stereotypes.add( new DefaultArtifactType( "war", "war", "", "java", false, true ) );
stereotypes.add( new DefaultArtifactType( "ear", "ear", "", "java", false, true ) );
stereotypes.add( new DefaultArtifactType( "rar", "rar", "", "java", false, true ) );
stereotypes.add( new DefaultArtifactType( "par", "par", "", "java", false, true ) );
session.setArtifactTypeRegistry( stereotypes );
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
Properties sysProps = System.getProperties();
session.setSystemProperties( sysProps );
session.setConfigProperties( sysProps );
return session;
}
}

View File

@ -1,54 +0,0 @@
package org.apache.maven.repository.internal;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.sonatype.aether.impl.ArtifactDescriptorReader;
import org.sonatype.aether.impl.internal.DefaultServiceLocator;
import org.sonatype.aether.impl.MetadataGeneratorFactory;
import org.sonatype.aether.impl.VersionRangeResolver;
import org.sonatype.aether.impl.VersionResolver;
/**
* A simple service locator that is already setup with all components from this library. To acquire a complete
* repository system, clients need to add some repository connectors for remote transfers.
*
* <p><em>Note:</em> This component is meant to assist those clients that employ the repository systems outside of an IoC
* container, Maven plugins should instead always use regular dependency injection to acquire the repository system:
* it is defined as Plexus component in aether-impl with its dependencies.</p>
*
* @author Benjamin Bentmann
*/
public class MavenServiceLocator
extends DefaultServiceLocator
{
/**
* Creates a new service locator that already knows about all service implementations included in this library.
*/
public MavenServiceLocator()
{
addService( ArtifactDescriptorReader.class, DefaultArtifactDescriptorReader.class );
addService( VersionResolver.class, DefaultVersionResolver.class );
addService( VersionRangeResolver.class, DefaultVersionRangeResolver.class );
addService( MetadataGeneratorFactory.class, SnapshotMetadataGeneratorFactory.class );
addService( MetadataGeneratorFactory.class, VersionsMetadataGeneratorFactory.class );
}
}

View File

@ -22,8 +22,8 @@ package org.apache.maven.repository.internal;
import java.io.File;
import java.util.Map;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.util.artifact.AbstractArtifact;
import org.eclipse.aether.artifact.AbstractArtifact;
import org.eclipse.aether.artifact.Artifact;
/**
* @author Benjamin Bentmann
@ -88,16 +88,6 @@ final class RelocatedArtifact
}
}
public String getBaseVersion()
{
return toBaseVersion( getVersion() );
}
public boolean isSnapshot()
{
return isSnapshot( getVersion() );
}
public String getClassifier()
{
return artifact.getClassifier();

View File

@ -33,7 +33,7 @@ import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.Snapshot;
import org.apache.maven.artifact.repository.metadata.SnapshotVersion;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.sonatype.aether.artifact.Artifact;
import org.eclipse.aether.artifact.Artifact;
/**
* @author Benjamin Bentmann

View File

@ -24,12 +24,12 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.deployment.DeployRequest;
import org.sonatype.aether.impl.MetadataGenerator;
import org.sonatype.aether.metadata.Metadata;
import org.sonatype.aether.util.ConfigUtils;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.deployment.DeployRequest;
import org.eclipse.aether.impl.MetadataGenerator;
import org.eclipse.aether.metadata.Metadata;
import org.eclipse.aether.util.ConfigUtils;
/**
* @author Benjamin Bentmann

View File

@ -20,11 +20,11 @@ package org.apache.maven.repository.internal;
*/
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.deployment.DeployRequest;
import org.sonatype.aether.impl.MetadataGenerator;
import org.sonatype.aether.impl.MetadataGeneratorFactory;
import org.sonatype.aether.installation.InstallRequest;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.deployment.DeployRequest;
import org.eclipse.aether.impl.MetadataGenerator;
import org.eclipse.aether.impl.MetadataGeneratorFactory;
import org.eclipse.aether.installation.InstallRequest;
/**
* @author Benjamin Bentmann
@ -44,7 +44,7 @@ public class SnapshotMetadataGeneratorFactory
return new RemoteSnapshotMetadataGenerator( session, request );
}
public int getPriority()
public float getPriority()
{
return 10;
}

View File

@ -26,8 +26,8 @@ import java.util.LinkedHashSet;
import org.apache.maven.artifact.repository.metadata.Metadata;
import org.apache.maven.artifact.repository.metadata.Versioning;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.util.artifact.ArtifactProperties;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.ArtifactProperties;
/**
* @author Benjamin Bentmann

View File

@ -25,12 +25,12 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.deployment.DeployRequest;
import org.sonatype.aether.impl.MetadataGenerator;
import org.sonatype.aether.installation.InstallRequest;
import org.sonatype.aether.metadata.Metadata;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.deployment.DeployRequest;
import org.eclipse.aether.impl.MetadataGenerator;
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.metadata.Metadata;
/**
* @author Benjamin Bentmann

View File

@ -20,11 +20,11 @@ package org.apache.maven.repository.internal;
*/
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.deployment.DeployRequest;
import org.sonatype.aether.impl.MetadataGenerator;
import org.sonatype.aether.impl.MetadataGeneratorFactory;
import org.sonatype.aether.installation.InstallRequest;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.deployment.DeployRequest;
import org.eclipse.aether.impl.MetadataGenerator;
import org.eclipse.aether.impl.MetadataGeneratorFactory;
import org.eclipse.aether.installation.InstallRequest;
/**
* @author Benjamin Bentmann
@ -44,7 +44,7 @@ public class VersionsMetadataGeneratorFactory
return new VersionsMetadataGenerator( session, request );
}
public int getPriority()
public float getPriority()
{
return 5;
}

View File

@ -1,76 +0,0 @@
package org.apache.maven.repository.internal;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.net.MalformedURLException;
import org.apache.maven.repository.internal.util.ConsoleRepositoryListener;
import org.apache.maven.repository.internal.util.ConsoleTransferListener;
import org.codehaus.plexus.PlexusTestCase;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
public abstract class AbstractRepositoryTestCase
extends PlexusTestCase
{
protected RepositorySystem system;
protected RepositorySystemSession session;
@Override
protected void setUp()
throws Exception
{
super.setUp();
system = lookup( RepositorySystem.class );
session = newMavenRepositorySystemSession( system );
}
@Override
protected void tearDown()
throws Exception
{
session = null;
system = null;
super.tearDown();
}
public static RepositorySystemSession newMavenRepositorySystemSession( RepositorySystem system )
{
MavenRepositorySystemSession session = new MavenRepositorySystemSession( true );
LocalRepository localRepo = new LocalRepository( "target/local-repo" );
session.setLocalRepositoryManager( system.newLocalRepositoryManager( localRepo ) );
session.setTransferListener( new ConsoleTransferListener() );
session.setRepositoryListener( new ConsoleRepositoryListener() );
return session;
}
public static RemoteRepository newTestRepository()
throws MalformedURLException
{
return new RemoteRepository( "repo", "default",
getTestFile( "target/test-classes/repo" ).toURI().toURL().toString() );
}
}

View File

@ -1,96 +0,0 @@
package org.apache.maven.repository.internal;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.impl.VersionResolver;
import org.sonatype.aether.resolution.VersionRequest;
import org.sonatype.aether.resolution.VersionResult;
import org.sonatype.aether.util.artifact.DefaultArtifact;
public class DefaultVersionResolverTest
extends AbstractRepositoryTestCase
{
private DefaultVersionResolver versionResolver;
@Override
protected void setUp()
throws Exception
{
super.setUp();
// be sure we're testing the right class, i.e. DefaultVersionResolver.class
versionResolver = (DefaultVersionResolver) lookup( VersionResolver.class, "default" );
}
@Override
protected void tearDown()
throws Exception
{
versionResolver = null;
super.tearDown();
}
public void testResolveSeparateInstalledClassifiedNonUniqueVersionedArtifacts()
throws Exception
{
VersionRequest requestB = new VersionRequest();
requestB.addRepository( newTestRepository() );
Artifact artifactB =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", "07.20.3-SNAPSHOT" );
requestB.setArtifact( artifactB );
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
assertEquals( "07.20.3-20120809.112920-97", resultB.getVersion() );
VersionRequest requestA = new VersionRequest();
requestA.addRepository( newTestRepository() );
Artifact artifactA =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", "07.20.3-SNAPSHOT" );
requestA.setArtifact( artifactA );
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
assertEquals( "07.20.3-20120809.112124-88", resultA.getVersion() );
}
public void testResolveSeparateInstalledClassifiedNonVersionedArtifacts()
throws Exception
{
VersionRequest requestA = new VersionRequest();
requestA.addRepository( newTestRepository() );
String versionA = "07.20.3-20120809.112124-88";
Artifact artifactA =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierA", "jar", versionA );
requestA.setArtifact( artifactA );
VersionResult resultA = versionResolver.resolveVersion( session, requestA );
assertEquals( versionA, resultA.getVersion() );
VersionRequest requestB = new VersionRequest();
requestB.addRepository( newTestRepository() );
String versionB = "07.20.3-20120809.112920-97";
Artifact artifactB =
new DefaultArtifact( "org.apache.maven.its", "dep-mng5324", "classifierB", "jar", versionB );
requestB.setArtifact( artifactB );
VersionResult resultB = versionResolver.resolveVersion( session, requestB );
assertEquals( versionB, resultB.getVersion() );
}
}

View File

@ -19,26 +19,26 @@ package org.apache.maven.repository.internal;
* under the License.
*/
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.impl.MetadataGeneratorFactory;
import org.sonatype.aether.spi.locator.ServiceLocator;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.impl.MetadataGeneratorFactory;
import org.eclipse.aether.spi.locator.ServiceLocator;
import junit.framework.TestCase;
public class DefaultServiceLocatorTest
public class MavenRepositorySystemUtilsTest
extends TestCase
{
public void testGetRepositorySystem()
{
ServiceLocator locator = new MavenServiceLocator();
ServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
RepositorySystem repoSys = locator.getService( RepositorySystem.class );
assertNotNull( repoSys );
}
public void testGetMetadataGeneratorFactories()
{
ServiceLocator locator = new MavenServiceLocator();
ServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
assertEquals( 2, locator.getServices( MetadataGeneratorFactory.class ).size() );
}

View File

@ -1,220 +0,0 @@
package org.apache.maven.repository.internal;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.Arrays;
import java.util.List;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.collection.CollectRequest;
import org.sonatype.aether.collection.CollectResult;
import org.sonatype.aether.graph.Dependency;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.resolution.ArtifactDescriptorRequest;
import org.sonatype.aether.resolution.ArtifactDescriptorResult;
import org.sonatype.aether.resolution.ArtifactRequest;
import org.sonatype.aether.resolution.ArtifactResult;
import org.sonatype.aether.util.artifact.DefaultArtifact;
public class RepositorySystemTest
extends AbstractRepositoryTestCase
{
public void testResolveVersionRange()
throws Exception
{
//VersionRangeResult resolveVersionRange( RepositorySystemSession session, VersionRangeRequest request )
// throws VersionRangeResolutionException;
}
public void testResolveVersion()
throws Exception
{
//VersionResult resolveVersion( RepositorySystemSession session, VersionRequest request )
// throws VersionResolutionException;
}
public void testReadArtifactDescriptor()
throws Exception
{
Artifact artifact = new DefaultArtifact( "ut.simple:artifact:extension:classifier:1.0" );
ArtifactDescriptorRequest request = new ArtifactDescriptorRequest();
request.setArtifact( artifact );
request.addRepository( newTestRepository() );
ArtifactDescriptorResult result = system.readArtifactDescriptor( session, request );
List<Dependency> deps = result.getDependencies();
assertEquals( 2, deps.size() );
checkUtSimpleArtifactDependencies( deps.get( 0 ), deps.get( 1 ) );
}
/**
* check ut.simple:artifact:1.0 dependencies
*/
private void checkUtSimpleArtifactDependencies( Dependency dep1, Dependency dep2 )
{
assertEquals( "compile", dep1.getScope() );
assertFalse( dep1.isOptional() );
assertEquals( 0, dep1.getExclusions().size() );
Artifact depArtifact = dep1.getArtifact();
assertEquals( "ut.simple", depArtifact.getGroupId() );
assertEquals( "dependency", depArtifact.getArtifactId() );
assertEquals( "1.0", depArtifact.getVersion() );
assertEquals( "1.0", depArtifact.getBaseVersion() );
assertNull( depArtifact.getFile() );
assertFalse( depArtifact.isSnapshot() );
assertEquals( "", depArtifact.getClassifier() );
assertEquals( "jar", depArtifact.getExtension() );
assertEquals( "java", depArtifact.getProperty( "language", null ) );
assertEquals( "jar", depArtifact.getProperty( "type", null ) );
assertEquals( "true", depArtifact.getProperty( "constitutesBuildPath", null ) );
assertEquals( "false", depArtifact.getProperty( "includesDependencies", null ) );
assertEquals( 4, depArtifact.getProperties().size() );
assertEquals( "compile", dep2.getScope() );
assertFalse( dep2.isOptional() );
assertEquals( 0, dep2.getExclusions().size() );
depArtifact = dep2.getArtifact();
assertEquals( "ut.simple", depArtifact.getGroupId() );
assertEquals( "dependency", depArtifact.getArtifactId() );
assertEquals( "1.0", depArtifact.getVersion() );
assertEquals( "1.0", depArtifact.getBaseVersion() );
assertNull( depArtifact.getFile() );
assertFalse( depArtifact.isSnapshot() );
assertEquals( "sources", depArtifact.getClassifier() );
assertEquals( "jar", depArtifact.getExtension() );
assertEquals( "java", depArtifact.getProperty( "language", null ) );
assertEquals( "jar", depArtifact.getProperty( "type", null ) ); // shouldn't it be java-sources given the classifier?
assertEquals( "true", depArtifact.getProperty( "constitutesBuildPath", null ) ); // shouldn't it be false given the classifier?
assertEquals( "false", depArtifact.getProperty( "includesDependencies", null ) );
assertEquals( 4, depArtifact.getProperties().size() );
}
public void testCollectDependencies()
throws Exception
{
Artifact artifact = new DefaultArtifact( "ut.simple:artifact:extension:classifier:1.0" );
// notice: extension and classifier not really used in this test...
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot( new Dependency( artifact, null ) );
collectRequest.addRepository( newTestRepository() );
CollectResult collectResult = system.collectDependencies( session, collectRequest );
List<DependencyNode> nodes = collectResult.getRoot().getChildren();
assertEquals( 2, nodes.size() );
checkUtSimpleArtifactDependencies( nodes.get( 0 ).getDependency(), nodes.get( 1 ).getDependency() );
}
public void testResolveArtifact()
throws Exception
{
Artifact artifact = new DefaultArtifact( "ut.simple:artifact:1.0" );
ArtifactRequest artifactRequest = new ArtifactRequest();
artifactRequest.setArtifact( artifact );
artifactRequest.addRepository( newTestRepository() );
ArtifactResult artifactResult = system.resolveArtifact( session, artifactRequest );
checkArtifactResult( artifactResult, "artifact-1.0.jar" );
artifact = new DefaultArtifact( "ut.simple:artifact:zip:1.0" );
artifactRequest.setArtifact( artifact );
artifactResult = system.resolveArtifact( session, artifactRequest );
checkArtifactResult( artifactResult, "artifact-1.0.zip" );
artifact = new DefaultArtifact( "ut.simple:artifact:zip:classifier:1.0" );
artifactRequest.setArtifact( artifact );
artifactResult = system.resolveArtifact( session, artifactRequest );
checkArtifactResult( artifactResult, "artifact-1.0-classifier.zip" );
}
private void checkArtifactResult( ArtifactResult result, String filename )
{
assertFalse( result.isMissing() );
assertTrue( result.isResolved() );
Artifact artifact = result.getArtifact();
assertNotNull( artifact.getFile() );
assertEquals( filename, artifact.getFile().getName() );
}
public void testResolveArtifacts()
throws Exception
{
ArtifactRequest req1 = new ArtifactRequest();
req1.setArtifact( new DefaultArtifact( "ut.simple:artifact:1.0" ) );
req1.addRepository( newTestRepository() );
ArtifactRequest req2 = new ArtifactRequest();
req2.setArtifact( new DefaultArtifact( "ut.simple:artifact:zip:1.0" ) );
req2.addRepository( newTestRepository() );
ArtifactRequest req3 = new ArtifactRequest();
req3.setArtifact( new DefaultArtifact( "ut.simple:artifact:zip:classifier:1.0" ) );
req3.addRepository( newTestRepository() );
List<ArtifactRequest> requests = Arrays.asList( new ArtifactRequest[] { req1, req2, req3 } );
List<ArtifactResult> results = system.resolveArtifacts( session, requests );
assertEquals( 3, results.size() );
checkArtifactResult( results.get( 0 ), "artifact-1.0.jar" );
checkArtifactResult( results.get( 1 ), "artifact-1.0.zip" );
checkArtifactResult( results.get( 2 ), "artifact-1.0-classifier.zip" );
}
public void testResolveMetadata()
throws Exception
{
//List<MetadataResult> resolveMetadata( RepositorySystemSession session,
// Collection<? extends MetadataRequest> requests );
}
public void testInstall()
throws Exception
{
//InstallResult install( RepositorySystemSession session, InstallRequest request )
// throws InstallationException;
// release, snapshot unique ou non unique, attachement
}
public void testDeploy()
throws Exception
{
//DeployResult deploy( RepositorySystemSession session, DeployRequest request )
// throws DeploymentException;
}
public void testNewLocalRepositoryManager()
throws Exception
{
//LocalRepositoryManager newLocalRepositoryManager( LocalRepository localRepository );
}
public void testNewSyncContext()
throws Exception
{
//SyncContext newSyncContext( RepositorySystemSession session, boolean shared );
}
}

View File

@ -1,132 +0,0 @@
package org.apache.maven.repository.internal.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.PrintStream;
import org.sonatype.aether.AbstractRepositoryListener;
import org.sonatype.aether.RepositoryEvent;
public class ConsoleRepositoryListener
extends AbstractRepositoryListener
{
private PrintStream out;
public ConsoleRepositoryListener()
{
this( null );
}
public ConsoleRepositoryListener( PrintStream out )
{
this.out = ( out != null ) ? out : System.out;
}
public void artifactDeployed( RepositoryEvent event )
{
println( "artifactDeployed", event.getArtifact() + " to " + event.getRepository() );
}
public void artifactDeploying( RepositoryEvent event )
{
println( "artifactDeploying", event.getArtifact() + " to " + event.getRepository() );
}
public void artifactDescriptorInvalid( RepositoryEvent event )
{
println( "artifactDescriptorInvalid", "for " + event.getArtifact() + ": " + event.getException().getMessage() );
}
public void artifactDescriptorMissing( RepositoryEvent event )
{
println( "artifactDescriptorMissing", "for " + event.getArtifact() );
}
public void artifactInstalled( RepositoryEvent event )
{
println( "artifactInstalled", event.getArtifact() + " to " + event.getFile() );
}
public void artifactInstalling( RepositoryEvent event )
{
println( "artifactInstalling", event.getArtifact() + " to " + event.getFile() );
}
public void artifactResolved( RepositoryEvent event )
{
println( "artifactResolved", event.getArtifact() + " from " + event.getRepository() );
}
public void artifactDownloading( RepositoryEvent event )
{
println( "artifactDownloading", event.getArtifact() + " from " + event.getRepository() );
}
public void artifactDownloaded( RepositoryEvent event )
{
println( "artifactDownloaded", event.getArtifact() + " from " + event.getRepository() );
}
public void artifactResolving( RepositoryEvent event )
{
println( "artifactResolving", event.getArtifact().toString() );
}
public void metadataDeployed( RepositoryEvent event )
{
println( "metadataDeployed", event.getMetadata() + " to " + event.getRepository() );
}
public void metadataDeploying( RepositoryEvent event )
{
println( "metadataDeploying", event.getMetadata() + " to " + event.getRepository() );
}
public void metadataInstalled( RepositoryEvent event )
{
println( "metadataInstalled", event.getMetadata() + " to " + event.getFile() );
}
public void metadataInstalling( RepositoryEvent event )
{
println( "metadataInstalling", event.getMetadata() + " to " + event.getFile() );
}
public void metadataInvalid( RepositoryEvent event )
{
println( "metadataInvalid", event.getMetadata().toString() );
}
public void metadataResolved( RepositoryEvent event )
{
println( "metadataResolved", event.getMetadata() + " from " + event.getRepository() );
}
public void metadataResolving( RepositoryEvent event )
{
println( "metadataResolving", event.getMetadata() + " from " + event.getRepository() );
}
private void println( String event, String message )
{
out.println( "Aether Repository - " + event + ": " + message );
}
}

View File

@ -1,186 +0,0 @@
package org.apache.maven.repository.internal.util;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.PrintStream;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.sonatype.aether.transfer.AbstractTransferListener;
import org.sonatype.aether.transfer.TransferEvent;
import org.sonatype.aether.transfer.TransferResource;
public class ConsoleTransferListener
extends AbstractTransferListener
{
private PrintStream out;
private Map<TransferResource, Long> downloads = new ConcurrentHashMap<TransferResource, Long>();
private int lastLength;
public ConsoleTransferListener()
{
this( null );
}
public ConsoleTransferListener( PrintStream out )
{
this.out = ( out != null ) ? out : System.out;
}
@Override
public void transferInitiated( TransferEvent event )
{
String message = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
println( "transferInitiated", message + ": " + event.getResource().getRepositoryUrl() + event.getResource().getResourceName() );
}
@Override
public void transferProgressed( TransferEvent event )
{
TransferResource resource = event.getResource();
downloads.put( resource, Long.valueOf( event.getTransferredBytes() ) );
StringBuilder buffer = new StringBuilder( 64 );
for ( Map.Entry<TransferResource, Long> entry : downloads.entrySet() )
{
long total = entry.getKey().getContentLength();
long complete = entry.getValue().longValue();
buffer.append( getStatus( complete, total ) ).append( " " );
}
int pad = lastLength - buffer.length();
lastLength = buffer.length();
pad( buffer, pad );
buffer.append( '\r' );
print( "transferProgressed", buffer.toString() );
}
private String getStatus( long complete, long total )
{
if ( total >= 1024 )
{
return toKB( complete ) + "/" + toKB( total ) + " KB ";
}
else if ( total >= 0 )
{
return complete + "/" + total + " B ";
}
else if ( complete >= 1024 )
{
return toKB( complete ) + " KB ";
}
else
{
return complete + " B ";
}
}
private void pad( StringBuilder buffer, int spaces )
{
String block = " ";
while ( spaces > 0 )
{
int n = Math.min( spaces, block.length() );
buffer.append( block, 0, n );
spaces -= n;
}
}
@Override
public void transferSucceeded( TransferEvent event )
{
transferCompleted( event );
TransferResource resource = event.getResource();
long contentLength = event.getTransferredBytes();
if ( contentLength >= 0 )
{
String type = ( event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploaded" : "Downloaded" );
String len = contentLength >= 1024 ? toKB( contentLength ) + " KB" : contentLength + " B";
String throughput = "";
long duration = System.currentTimeMillis() - resource.getTransferStartTime();
if ( duration > 0 )
{
DecimalFormat format = new DecimalFormat( "0.0", new DecimalFormatSymbols( Locale.ENGLISH ) );
double kbPerSec = ( contentLength / 1024.0 ) / ( duration / 1000.0 );
throughput = " at " + format.format( kbPerSec ) + " KB/sec";
}
println( "transferSucceeded", type + ": " + resource.getRepositoryUrl() + resource.getResourceName() + " ("
+ len + throughput + ")" );
}
}
@Override
public void transferFailed( TransferEvent event )
{
transferCompleted( event );
println( "transferFailed", event.getException().getClass() + ": " + event.getException().getMessage() );
}
private void transferCompleted( TransferEvent event )
{
downloads.remove( event.getResource() );
StringBuilder buffer = new StringBuilder( 64 );
pad( buffer, lastLength );
buffer.append( '\r' );
out.println( buffer );
}
@Override
public void transferCorrupted( TransferEvent event )
{
println( "transferCorrupted", event.getException().getClass() + ": " + event.getException().getMessage() );
}
protected long toKB( long bytes )
{
return ( bytes + 1023 ) / 1024;
}
private void println( String event, String message )
{
print( event, message );
out.println();
}
private void print( String event, String message )
{
out.print( "Aether Transfer - " + event );
if ( message != null )
{
out.print( ": " );
out.print( message );
}
}
}

View File

@ -72,7 +72,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-connector-wagon</artifactId>
<scope>test</scope>
</dependency>

View File

@ -37,15 +37,15 @@ import org.apache.maven.project.artifact.ProjectArtifactMetadata;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.deployment.DeployRequest;
import org.sonatype.aether.deployment.DeployResult;
import org.sonatype.aether.deployment.DeploymentException;
import org.sonatype.aether.metadata.MergeableMetadata;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.artifact.SubArtifact;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.deployment.DeployRequest;
import org.eclipse.aether.deployment.DeployResult;
import org.eclipse.aether.deployment.DeploymentException;
import org.eclipse.aether.metadata.MergeableMetadata;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.util.artifact.SubArtifact;
@Component( role = ArtifactDeployer.class, instantiationStrategy = "per-lookup" )
public class DefaultArtifactDeployer
@ -84,9 +84,9 @@ public class DefaultArtifactDeployer
DeployRequest request = new DeployRequest();
request.setTrace( DefaultRequestTrace.newChild( null, legacySupport.getSession().getCurrentProject() ) );
request.setTrace( RequestTrace.newChild( null, legacySupport.getSession().getCurrentProject() ) );
org.sonatype.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact( artifact );
org.eclipse.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact( artifact );
mainArtifact = mainArtifact.setFile( source );
request.addArtifact( mainArtifact );
@ -103,7 +103,7 @@ public class DefaultArtifactDeployer
{
if ( metadata instanceof ProjectArtifactMetadata )
{
org.sonatype.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" );
org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" );
pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() );
request.addArtifact( pomArtifact );
}
@ -126,8 +126,10 @@ public class DefaultArtifactDeployer
if ( deploymentRepository instanceof DefaultArtifactRepository
&& deploymentRepository.getAuthentication() == null )
{
remoteRepo.setAuthentication( session.getAuthenticationSelector().getAuthentication( remoteRepo ) );
remoteRepo.setProxy( session.getProxySelector().getProxy( remoteRepo ) );
RemoteRepository.Builder builder = new RemoteRepository.Builder( remoteRepo );
builder.setAuthentication( session.getAuthenticationSelector().getAuthentication( remoteRepo ) );
builder.setProxy( session.getProxySelector().getProxy( remoteRepo ) );
remoteRepo = builder.build();
}
request.setRepository( remoteRepo );

View File

@ -36,12 +36,12 @@ import org.apache.maven.project.artifact.ProjectArtifactMetadata;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.installation.InstallRequest;
import org.sonatype.aether.installation.InstallationException;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.artifact.SubArtifact;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.installation.InstallationException;
import org.eclipse.aether.util.artifact.SubArtifact;
/**
* @author Jason van Zyl
@ -77,9 +77,9 @@ public class DefaultArtifactInstaller
InstallRequest request = new InstallRequest();
request.setTrace( DefaultRequestTrace.newChild( null, legacySupport.getSession().getCurrentProject() ) );
request.setTrace( RequestTrace.newChild( null, legacySupport.getSession().getCurrentProject() ) );
org.sonatype.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact( artifact );
org.eclipse.aether.artifact.Artifact mainArtifact = RepositoryUtils.toArtifact( artifact );
mainArtifact = mainArtifact.setFile( source );
request.addArtifact( mainArtifact );
@ -87,7 +87,7 @@ public class DefaultArtifactInstaller
{
if ( metadata instanceof ProjectArtifactMetadata )
{
org.sonatype.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" );
org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" );
pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() );
request.addArtifact( pomArtifact );
}

View File

@ -28,7 +28,7 @@ import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.sonatype.aether.RepositorySystemSession;
import org.eclipse.aether.RepositorySystemSession;
/**
* @author jdcasey

View File

@ -20,14 +20,18 @@ package org.apache.maven.artifact.repository.metadata;
*/
import java.io.File;
import java.util.Collections;
import java.util.Map;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
import org.codehaus.plexus.util.FileUtils;
import org.sonatype.aether.RepositoryException;
import org.sonatype.aether.metadata.MergeableMetadata;
import org.eclipse.aether.RepositoryException;
import org.eclipse.aether.metadata.AbstractMetadata;
import org.eclipse.aether.metadata.MergeableMetadata;
import org.eclipse.aether.metadata.Metadata;
/**
* <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
@ -36,6 +40,7 @@ import org.sonatype.aether.metadata.MergeableMetadata;
* @author Benjamin Bentmann
*/
public final class MetadataBridge
extends AbstractMetadata
implements MergeableMetadata
{
@ -127,6 +132,17 @@ public final class MetadataBridge
}
}
public Map<String, String> getProperties()
{
return Collections.emptyMap();
}
@Override
public Metadata setProperties( Map<String, String> properties )
{
return this;
}
@SuppressWarnings( "deprecation" )
static class MetadataRepository
extends DefaultArtifactRepository

View File

@ -56,11 +56,11 @@ import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.LocalRepositoryManager;
import org.sonatype.aether.resolution.ArtifactRequest;
import org.sonatype.aether.resolution.ArtifactResult;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.LocalRepositoryManager;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResult;
/**
* @author Jason van Zyl
@ -212,9 +212,9 @@ public class DefaultArtifactResolver
result = repoSystem.resolveArtifact( session, artifactRequest );
}
catch ( org.sonatype.aether.resolution.ArtifactResolutionException e )
catch ( org.eclipse.aether.resolution.ArtifactResolutionException e )
{
if ( e.getCause() instanceof org.sonatype.aether.transfer.ArtifactNotFoundException )
if ( e.getCause() instanceof org.eclipse.aether.transfer.ArtifactNotFoundException )
{
throw new ArtifactNotFoundException( e.getMessage(), artifact, remoteRepositories, e );
}

View File

@ -32,7 +32,7 @@ import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.sonatype.aether.RepositorySystemSession;
import org.eclipse.aether.RepositorySystemSession;
// This class needs to stick around because it was exposed the the remote resources plugin started using it instead of
// getting the repositories from the project.

View File

@ -73,10 +73,11 @@ import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.AuthenticationSelector;
import org.sonatype.aether.repository.ProxySelector;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.AuthenticationContext;
import org.eclipse.aether.repository.AuthenticationSelector;
import org.eclipse.aether.repository.ProxySelector;
import org.eclipse.aether.repository.RemoteRepository;
/**
* @author Jason van Zyl
@ -478,7 +479,7 @@ public class LegacyRepositorySystem
{
if ( session != null )
{
org.sonatype.aether.repository.MirrorSelector selector = session.getMirrorSelector();
org.eclipse.aether.repository.MirrorSelector selector = session.getMirrorSelector();
if ( selector != null )
{
RemoteRepository repo = selector.getMirror( RepositoryUtils.toRepo( repository ) );
@ -583,13 +584,18 @@ public class LegacyRepositorySystem
AuthenticationSelector selector = session.getAuthenticationSelector();
if ( selector != null )
{
org.sonatype.aether.repository.Authentication auth =
selector.getAuthentication( RepositoryUtils.toRepo( repository ) );
RemoteRepository repo = RepositoryUtils.toRepo( repository );
org.eclipse.aether.repository.Authentication auth = selector.getAuthentication( repo );
if ( auth != null )
{
Authentication result = new Authentication( auth.getUsername(), auth.getPassword() );
result.setPrivateKey( auth.getPrivateKeyFile() );
result.setPassphrase( auth.getPassphrase() );
repo = new RemoteRepository.Builder( repo ).setAuthentication( auth ).build();
AuthenticationContext authCtx = AuthenticationContext.forRepository( session, repo );
Authentication result =
new Authentication( authCtx.get( AuthenticationContext.USERNAME ),
authCtx.get( AuthenticationContext.PASSWORD ) );
result.setPrivateKey( authCtx.get( AuthenticationContext.PRIVATE_KEY_PATH ) );
result.setPassphrase( authCtx.get( AuthenticationContext.PRIVATE_KEY_PASSPHRASE ) );
authCtx.close();
return result;
}
}
@ -688,7 +694,8 @@ public class LegacyRepositorySystem
ProxySelector selector = session.getProxySelector();
if ( selector != null )
{
org.sonatype.aether.repository.Proxy proxy = selector.getProxy( RepositoryUtils.toRepo( repository ) );
RemoteRepository repo = RepositoryUtils.toRepo( repository );
org.eclipse.aether.repository.Proxy proxy = selector.getProxy( repo );
if ( proxy != null )
{
Proxy p = new Proxy();
@ -697,8 +704,13 @@ public class LegacyRepositorySystem
p.setPort( proxy.getPort() );
if ( proxy.getAuthentication() != null )
{
p.setUserName( proxy.getAuthentication().getUsername() );
p.setPassword( proxy.getAuthentication().getPassword() );
repo = new RemoteRepository.Builder( repo ).setProxy( proxy ).build();
AuthenticationContext authCtx = AuthenticationContext.forProxy( session, repo );
p.setUserName( authCtx.get( AuthenticationContext.USERNAME ) );
p.setPassword( authCtx.get( AuthenticationContext.PASSWORD ) );
p.setNtlmDomain( authCtx.get( AuthenticationContext.NTLM_DOMAIN ) );
p.setNtlmHost( authCtx.get( AuthenticationContext.NTLM_WORKSTATION ) );
authCtx.close();
}
return p;
}

View File

@ -36,26 +36,30 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.DefaultMavenExecutionResult;
import org.apache.maven.execution.MavenSession;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.collection.DependencyGraphTransformer;
import org.sonatype.aether.collection.DependencyManager;
import org.sonatype.aether.collection.DependencySelector;
import org.sonatype.aether.collection.DependencyTraverser;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
import org.sonatype.aether.util.graph.manager.ClassicDependencyManager;
import org.sonatype.aether.util.graph.selector.AndDependencySelector;
import org.sonatype.aether.util.graph.selector.ExclusionDependencySelector;
import org.sonatype.aether.util.graph.selector.OptionalDependencySelector;
import org.sonatype.aether.util.graph.selector.ScopeDependencySelector;
import org.sonatype.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
import org.sonatype.aether.util.graph.transformer.NearestVersionConflictResolver;
import org.sonatype.aether.util.graph.transformer.ConflictMarker;
import org.sonatype.aether.util.graph.transformer.JavaDependencyContextRefiner;
import org.sonatype.aether.util.graph.transformer.JavaEffectiveScopeCalculator;
import org.sonatype.aether.util.graph.traverser.FatArtifactTraverser;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.collection.DependencyGraphTransformer;
import org.eclipse.aether.collection.DependencyManager;
import org.eclipse.aether.collection.DependencySelector;
import org.eclipse.aether.collection.DependencyTraverser;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
import org.eclipse.aether.util.graph.selector.AndDependencySelector;
import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector;
import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
import org.eclipse.aether.util.graph.selector.ScopeDependencySelector;
import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
import org.eclipse.aether.util.graph.transformer.ConflictResolver;
import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
import org.eclipse.aether.util.graph.transformer.JavaScopeSelector;
import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@ -66,7 +70,14 @@ public abstract class AbstractArtifactComponentTestCase
protected ArtifactFactory artifactFactory;
protected ArtifactRepositoryFactory artifactRepositoryFactory;
@Override
protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
{
super.customizeContainerConfiguration( containerConfiguration );
containerConfiguration.setAutoWiring( true );
}
@Override
protected void setUp()
throws Exception
@ -331,8 +342,7 @@ public abstract class AbstractArtifactComponentTestCase
throws Exception
{
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
session.setIgnoreMissingArtifactDescriptor( true );
session.setIgnoreInvalidArtifactDescriptor( true );
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
DependencyTraverser depTraverser = new FatArtifactTraverser();
session.setDependencyTraverser( depTraverser );
@ -345,12 +355,13 @@ public abstract class AbstractArtifactComponentTestCase
session.setDependencySelector( depFilter );
DependencyGraphTransformer transformer =
new ChainedDependencyGraphTransformer( new ConflictMarker(), new JavaEffectiveScopeCalculator(),
new NearestVersionConflictResolver(),
new JavaDependencyContextRefiner() );
new ConflictResolver( new NearestVersionSelector(), new JavaScopeSelector(),
new SimpleOptionalitySelector(), new JavaScopeDeriver() );
new ChainedDependencyGraphTransformer( transformer, new JavaDependencyContextRefiner() );
session.setDependencyGraphTransformer( transformer );
session.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepository().getBasedir() ) );
LocalRepository localRepo = new LocalRepository( localRepository().getBasedir() );
session.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( localRepo ) );
return session;
}

View File

@ -27,8 +27,10 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.model.building.ModelBuildingException;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
import org.eclipse.aether.DefaultRepositorySystemSession;
/**
* @author Jason van Zyl
@ -39,7 +41,14 @@ public abstract class AbstractMavenProjectTestCase
protected ProjectBuilder projectBuilder;
protected RepositorySystem repositorySystem;
@Override
protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
{
super.customizeContainerConfiguration( containerConfiguration );
containerConfiguration.setAutoWiring( true );
}
protected void setUp()
throws Exception
{
@ -166,7 +175,7 @@ public abstract class AbstractMavenProjectTestCase
protected void initRepoSession( ProjectBuildingRequest request )
{
File localRepo = new File( request.getLocalRepository().getBasedir() );
MavenRepositorySystemSession session = new MavenRepositorySystemSession( true );
DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
session.setLocalRepositoryManager( new LegacyLocalRepositoryManager( localRepo ) );
request.setRepositorySession( session );
}

View File

@ -26,13 +26,13 @@ import java.util.Collections;
import java.util.List;
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.impl.ArtifactResolver;
import org.sonatype.aether.resolution.ArtifactRequest;
import org.sonatype.aether.resolution.ArtifactResolutionException;
import org.sonatype.aether.resolution.ArtifactResult;
import org.sonatype.aether.transfer.ArtifactNotFoundException;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.impl.ArtifactResolver;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.transfer.ArtifactNotFoundException;
/**
* @author Benjamin Bentmann

View File

@ -21,22 +21,36 @@ package org.apache.maven.project;
import java.io.File;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.sonatype.aether.repository.LocalArtifactRequest;
import org.sonatype.aether.repository.LocalArtifactResult;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.metadata.Metadata;
import org.eclipse.aether.repository.LocalArtifactRegistration;
import org.eclipse.aether.repository.LocalArtifactRequest;
import org.eclipse.aether.repository.LocalArtifactResult;
import org.eclipse.aether.repository.LocalMetadataRegistration;
import org.eclipse.aether.repository.LocalMetadataRequest;
import org.eclipse.aether.repository.LocalMetadataResult;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.LocalRepositoryManager;
import org.eclipse.aether.repository.RemoteRepository;
/**
* @author Benjamin Bentmann
*/
public class LegacyLocalRepositoryManager
extends SimpleLocalRepositoryManager
implements LocalRepositoryManager
{
private final LocalRepository repository;
public LegacyLocalRepositoryManager( File basedir )
{
super( basedir );
this.repository = new LocalRepository( basedir.getAbsoluteFile(), "legacy" );
}
public LocalRepository getRepository()
{
return repository;
}
public String getPathForLocalArtifact( Artifact artifact )
@ -59,17 +73,120 @@ public class LegacyLocalRepositoryManager
return path.toString();
}
public String getPathForRemoteArtifact( Artifact artifact, RemoteRepository repository, String context )
{
return getPathForLocalArtifact( artifact );
}
public String getPathForLocalMetadata( Metadata metadata )
{
return getPath( metadata, "local" );
}
public String getPathForRemoteMetadata( Metadata metadata, RemoteRepository repository, String context )
{
return getPath( metadata, getRepositoryKey( repository, context ) );
}
String getRepositoryKey( RemoteRepository repository, String context )
{
return repository.getId();
}
private String getPath( Metadata metadata, String repositoryKey )
{
StringBuilder path = new StringBuilder( 128 );
if ( metadata.getGroupId().length() > 0 )
{
path.append( metadata.getGroupId().replace( '.', '/' ) ).append( '/' );
if ( metadata.getArtifactId().length() > 0 )
{
path.append( metadata.getArtifactId() ).append( '/' );
if ( metadata.getVersion().length() > 0 )
{
path.append( metadata.getVersion() ).append( '/' );
}
}
}
path.append( insertRepositoryKey( metadata.getType(), repositoryKey ) );
return path.toString();
}
private String insertRepositoryKey( String filename, String repositoryKey )
{
String result;
int idx = filename.indexOf( '.' );
if ( idx < 0 )
{
result = filename + '-' + repositoryKey;
}
else
{
result = filename.substring( 0, idx ) + '-' + repositoryKey + filename.substring( idx );
}
return result;
}
public LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request )
{
String path = getPathForLocalArtifact( request.getArtifact() );
File file = new File( getRepository().getBasedir(), path );
LocalArtifactResult result = new LocalArtifactResult( request );
if ( file.isFile() )
{
result.setFile( file );
result.setAvailable( true );
}
return result;
}
String path = getPathForLocalArtifact( request.getArtifact() );
File file = new File( getRepository().getBasedir(), path );
LocalArtifactResult result = new LocalArtifactResult( request );
if ( file.isFile() )
{
result.setFile( file );
result.setAvailable( true );
}
return result;
}
public void add( RepositorySystemSession session, LocalArtifactRegistration request )
{
// noop
}
public LocalMetadataResult find( RepositorySystemSession session, LocalMetadataRequest request )
{
LocalMetadataResult result = new LocalMetadataResult( request );
String path;
Metadata metadata = request.getMetadata();
String context = request.getContext();
RemoteRepository remote = request.getRepository();
if ( remote != null )
{
path = getPathForRemoteMetadata( metadata, remote, context );
}
else
{
path = getPathForLocalMetadata( metadata );
}
File file = new File( getRepository().getBasedir(), path );
if ( file.isFile() )
{
result.setFile( file );
}
return result;
}
public void add( RepositorySystemSession session, LocalMetadataRegistration request )
{
// noop
}
public String toString()
{
return String.valueOf( getRepository() );
}
}

View File

@ -25,8 +25,8 @@ import java.util.Iterator;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.repository.internal.DefaultArtifactDescriptorReader;
import org.sonatype.aether.impl.ArtifactDescriptorReader;
import org.sonatype.aether.impl.ArtifactResolver;
import org.eclipse.aether.impl.ArtifactDescriptorReader;
import org.eclipse.aether.impl.ArtifactResolver;
public class ProjectClasspathTest
extends AbstractMavenProjectTestCase

View File

@ -32,9 +32,11 @@ import org.apache.maven.model.Repository;
import org.apache.maven.model.RepositoryPolicy;
import org.apache.maven.plugin.LegacySupport;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
/**
* Tests {@link LegacyRepositorySystem}.
@ -47,7 +49,14 @@ public class LegacyRepositorySystemTest
private RepositorySystem repositorySystem;
private ResolutionErrorHandler resolutionErrorHandler;
@Override
protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
{
super.customizeContainerConfiguration( containerConfiguration );
containerConfiguration.setAutoWiring( true );
}
@Override
protected void setUp()
throws Exception
@ -114,7 +123,8 @@ public class LegacyRepositorySystemTest
.setLocalRepository( getLocalRepository() );
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
session.setLocalRepositoryManager( new SimpleLocalRepositoryManager( request.getLocalRepository().getBasedir() ) );
LocalRepository localRepo = new LocalRepository( request.getLocalRepository().getBasedir() );
session.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( localRepo ) );
LegacySupport legacySupport = lookup( LegacySupport.class );
legacySupport.setSession( new MavenSession( getContainer(), session, new DefaultMavenExecutionRequest(),
new DefaultMavenExecutionResult() ) );

View File

@ -22,6 +22,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.Authentication;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.settings.Server;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
/**
@ -34,6 +35,13 @@ public class LegacyRepositorySystemTest
{
private RepositorySystem repositorySystem;
@Override
protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
{
super.customizeContainerConfiguration( containerConfiguration );
containerConfiguration.setAutoWiring( true );
}
@Override
protected void setUp()
throws Exception

View File

@ -61,7 +61,7 @@ under the License.
<field-name>legacySupport</field-name>
</requirement>
<requirement>
<role>org.sonatype.aether.RepositorySystem</role>
<role>org.eclipse.aether.RepositorySystem</role>
<role-hint>default</role-hint>
<field-name>repoSystem</field-name>
</requirement>

View File

@ -59,15 +59,15 @@
<artifactId>maven-aether-provider</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-impl</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-util</artifactId>
</dependency>
<!-- Plexus -->

View File

@ -62,7 +62,6 @@ import org.apache.maven.project.ProjectBuildingResult;
import org.apache.maven.project.ProjectSorter;
import org.apache.maven.repository.DelegatingLocalArtifactRepository;
import org.apache.maven.repository.LocalRepositoryNotAccessibleException;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
@ -80,18 +79,38 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.dag.CycleDetectedException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.sonatype.aether.ConfigurationProperties;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.Authentication;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RepositoryPolicy;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
import org.sonatype.aether.util.repository.ChainedWorkspaceReader;
import org.sonatype.aether.util.repository.DefaultAuthenticationSelector;
import org.sonatype.aether.util.repository.DefaultMirrorSelector;
import org.sonatype.aether.util.repository.DefaultProxySelector;
import org.eclipse.aether.ConfigurationProperties;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.collection.DependencyGraphTransformer;
import org.eclipse.aether.collection.DependencyManager;
import org.eclipse.aether.collection.DependencySelector;
import org.eclipse.aether.collection.DependencyTraverser;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RepositoryPolicy;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.resolution.ResolutionErrorPolicy;
import org.eclipse.aether.util.graph.manager.ClassicDependencyManager;
import org.eclipse.aether.util.graph.selector.AndDependencySelector;
import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector;
import org.eclipse.aether.util.graph.selector.OptionalDependencySelector;
import org.eclipse.aether.util.graph.selector.ScopeDependencySelector;
import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
import org.eclipse.aether.util.graph.transformer.ConflictResolver;
import org.eclipse.aether.util.graph.transformer.JavaScopeDeriver;
import org.eclipse.aether.util.graph.transformer.JavaScopeSelector;
import org.eclipse.aether.util.graph.transformer.JavaDependencyContextRefiner;
import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
import org.eclipse.aether.util.repository.AuthenticationBuilder;
import org.eclipse.aether.util.repository.ChainedWorkspaceReader;
import org.eclipse.aether.util.repository.DefaultAuthenticationSelector;
import org.eclipse.aether.util.repository.DefaultMirrorSelector;
import org.eclipse.aether.util.repository.DefaultProxySelector;
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
import org.eclipse.aether.util.repository.SimpleResolutionErrorPolicy;
/**
* @author Jason van Zyl
@ -254,6 +273,8 @@ public class DefaultMaven
return processResult( result, e );
}
repoSession.setReadOnly();
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
try
{
@ -321,10 +342,12 @@ public class DefaultMaven
public RepositorySystemSession newRepositorySession( MavenExecutionRequest request )
{
MavenRepositorySystemSession session = new MavenRepositorySystemSession( false );
DefaultRepositorySystemSession session = new DefaultRepositorySystemSession();
session.setCache( request.getRepositoryCache() );
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
Map<Object, Object> configProps = new LinkedHashMap<Object, Object>();
configProps.put( ConfigurationProperties.USER_AGENT, getUserAgent() );
configProps.put( ConfigurationProperties.INTERACTIVE, Boolean.valueOf( request.isInteractiveMode() ) );
@ -346,8 +369,11 @@ public class DefaultMaven
session.setUpdatePolicy( null );
}
session.setNotFoundCachingEnabled( request.isCacheNotFound() );
session.setTransferErrorCachingEnabled( request.isCacheTransferError() );
int errorPolicy = 0;
errorPolicy |= request.isCacheNotFound() ? ResolutionErrorPolicy.CACHE_NOT_FOUND : 0;
errorPolicy |= request.isCacheTransferError() ? ResolutionErrorPolicy.CACHE_TRANSFER_ERROR : 0;
session.setResolutionErrorPolicy( new SimpleResolutionErrorPolicy( errorPolicy, errorPolicy
| ResolutionErrorPolicy.CACHE_NOT_FOUND ) );
session.setArtifactTypeRegistry( RepositoryUtils.newArtifactTypeRegistry( artifactHandlerManager ) );
@ -387,19 +413,21 @@ public class DefaultMaven
DefaultProxySelector proxySelector = new DefaultProxySelector();
for ( Proxy proxy : decrypted.getProxies() )
{
Authentication proxyAuth = new Authentication( proxy.getUsername(), proxy.getPassword() );
proxySelector.add( new org.sonatype.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(),
proxyAuth ), proxy.getNonProxyHosts() );
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername( proxy.getUsername() ).addPassword( proxy.getPassword() );
proxySelector.add( new org.eclipse.aether.repository.Proxy( proxy.getProtocol(), proxy.getHost(),
proxy.getPort(), authBuilder.build() ),
proxy.getNonProxyHosts() );
}
session.setProxySelector( proxySelector );
DefaultAuthenticationSelector authSelector = new DefaultAuthenticationSelector();
for ( Server server : decrypted.getServers() )
{
Authentication auth =
new Authentication( server.getUsername(), server.getPassword(), server.getPrivateKey(),
server.getPassphrase() );
authSelector.add( server.getId(), auth );
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername( server.getUsername() ).addPassword( server.getPassword() );
authBuilder.addPrivateKey( server.getPrivateKey(), server.getPassphrase() );
authSelector.add( server.getId(), authBuilder.build() );
if ( server.getConfiguration() != null )
{
@ -422,13 +450,30 @@ public class DefaultMaven
}
session.setAuthenticationSelector( authSelector );
DependencyTraverser depTraverser = new FatArtifactTraverser();
session.setDependencyTraverser( depTraverser );
DependencyManager depManager = new ClassicDependencyManager();
session.setDependencyManager( depManager );
DependencySelector depFilter =
new AndDependencySelector( new ScopeDependencySelector( "test", "provided" ), new OptionalDependencySelector(),
new ExclusionDependencySelector() );
session.setDependencySelector( depFilter );
DependencyGraphTransformer transformer =
new ConflictResolver( new NearestVersionSelector(), new JavaScopeSelector(),
new SimpleOptionalitySelector(), new JavaScopeDeriver() );
transformer = new ChainedDependencyGraphTransformer( transformer, new JavaDependencyContextRefiner() );
session.setDependencyGraphTransformer( transformer );
session.setTransferListener( request.getTransferListener() );
session.setRepositoryListener( eventSpyDispatcher.chainListener( new LoggingRepositoryListener( logger ) ) );
session.setUserProps( request.getUserProperties() );
session.setSystemProps( request.getSystemProperties() );
session.setConfigProps( configProps );
session.setUserProperties( request.getUserProperties() );
session.setSystemProperties( request.getSystemProperties() );
session.setConfigProperties( configProps );
return session;
}

View File

@ -22,9 +22,9 @@ package org.apache.maven;
import java.io.FileNotFoundException;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.AbstractRepositoryListener;
import org.sonatype.aether.RepositoryEvent;
import org.sonatype.aether.transfer.MetadataNotFoundException;
import org.eclipse.aether.AbstractRepositoryListener;
import org.eclipse.aether.RepositoryEvent;
import org.eclipse.aether.transfer.MetadataNotFoundException;
/**
* @author Benjamin Bentmann

View File

@ -21,9 +21,9 @@ package org.apache.maven;
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.project.MavenProject;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.repository.WorkspaceRepository;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.repository.WorkspaceRepository;
import java.io.File;
import java.util.ArrayList;
@ -43,9 +43,9 @@ import java.util.Map;
class ReactorReader
implements WorkspaceReader
{
private static final Collection<String> JAR_LIKE_TYPES = Arrays.asList( "jar", "test-jar", "ejb-client" );
private final static Collection<String> JAR_LIKE_TYPES = Arrays.asList( "jar", "test-jar", "ejb-client" );
private static final Collection<String> COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" );
private final static Collection<String> COMPILE_PHASE_TYPES = Arrays.asList( "jar", "ejb-client" );
private Map<String, MavenProject> projectsByGAV;
@ -103,7 +103,7 @@ class ReactorReader
}
else
{
String type = artifact.getProperty( "type", "" );
String type = artifact.getProperty( "type", "");
if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) )
{
return new File( project.getBuild().getOutputDirectory() );

View File

@ -30,20 +30,21 @@ import org.apache.maven.artifact.handler.DefaultArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.artifact.ArtifactType;
import org.sonatype.aether.artifact.ArtifactTypeRegistry;
import org.sonatype.aether.graph.Dependency;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.graph.Exclusion;
import org.sonatype.aether.repository.Authentication;
import org.sonatype.aether.repository.Proxy;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.RepositoryPolicy;
import org.sonatype.aether.util.artifact.ArtifactProperties;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.DefaultArtifactType;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.ArtifactProperties;
import org.eclipse.aether.artifact.ArtifactType;
import org.eclipse.aether.artifact.ArtifactTypeRegistry;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.artifact.DefaultArtifactType;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.graph.Exclusion;
import org.eclipse.aether.repository.Authentication;
import org.eclipse.aether.repository.Proxy;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.RepositoryPolicy;
import org.eclipse.aether.util.repository.AuthenticationBuilder;
/**
* <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
@ -197,12 +198,14 @@ public class RepositoryUtils
RemoteRepository result = null;
if ( repo != null )
{
result = new RemoteRepository( repo.getId(), getLayout( repo ), repo.getUrl() );
result.setPolicy( true, toPolicy( repo.getSnapshots() ) );
result.setPolicy( false, toPolicy( repo.getReleases() ) );
result.setAuthentication( toAuthentication( repo.getAuthentication() ) );
result.setProxy( toProxy( repo.getProxy() ) );
result.setMirroredRepositories( toRepos( repo.getMirroredRepositories() ) );
RemoteRepository.Builder builder =
new RemoteRepository.Builder( repo.getId(), getLayout( repo ), repo.getUrl() );
builder.setSnapshotPolicy( toPolicy( repo.getSnapshots() ) );
builder.setReleasePolicy( toPolicy( repo.getReleases() ) );
builder.setAuthentication( toAuthentication( repo.getAuthentication() ) );
builder.setProxy( toProxy( repo.getProxy() ) );
builder.setMirroredRepositories( toRepos( repo.getMirroredRepositories() ) );
result = builder.build();
}
return result;
}
@ -247,8 +250,10 @@ public class RepositoryUtils
Authentication result = null;
if ( auth != null )
{
result =
new Authentication( auth.getUsername(), auth.getPassword(), auth.getPrivateKey(), auth.getPassphrase() );
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername( auth.getUsername() ).addPassword( auth.getPassword() );
authBuilder.addPrivateKey( auth.getPrivateKey(), auth.getPassphrase() );
result = authBuilder.build();
}
return result;
}
@ -258,8 +263,9 @@ public class RepositoryUtils
Proxy result = null;
if ( proxy != null )
{
Authentication auth = new Authentication( proxy.getUserName(), proxy.getPassword() );
result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), auth );
AuthenticationBuilder authBuilder = new AuthenticationBuilder();
authBuilder.addUsername( proxy.getUserName() ).addPassword( proxy.getPassword() );
result = new Proxy( proxy.getProtocol(), proxy.getHost(), proxy.getPort(), authBuilder.build() );
}
return result;
}

View File

@ -29,21 +29,20 @@ import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataStoreException;
import org.apache.maven.repository.Proxy;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.metadata.Metadata;
import org.sonatype.aether.repository.LocalArtifactRegistration;
import org.sonatype.aether.repository.LocalArtifactRequest;
import org.sonatype.aether.repository.LocalArtifactResult;
import org.sonatype.aether.repository.LocalMetadataRegistration;
import org.sonatype.aether.repository.LocalMetadataRequest;
import org.sonatype.aether.repository.LocalMetadataResult;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.LocalRepositoryManager;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
import org.sonatype.aether.util.FilterRepositorySystemSession;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.metadata.Metadata;
import org.eclipse.aether.repository.LocalArtifactRegistration;
import org.eclipse.aether.repository.LocalArtifactRequest;
import org.eclipse.aether.repository.LocalArtifactResult;
import org.eclipse.aether.repository.LocalMetadataRegistration;
import org.eclipse.aether.repository.LocalMetadataRequest;
import org.eclipse.aether.repository.LocalMetadataResult;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.LocalRepositoryManager;
import org.eclipse.aether.repository.RemoteRepository;
/**
* <strong>Warning:</strong> This is an internal utility class that is only public for technical reasons, it is not part
@ -84,14 +83,7 @@ public class LegacyLocalRepositoryManager
final LocalRepositoryManager llrm = new LegacyLocalRepositoryManager( repository );
return new FilterRepositorySystemSession( session )
{
@Override
public LocalRepositoryManager getLocalRepositoryManager()
{
return llrm;
}
};
return new DefaultRepositorySystemSession( session ).setLocalRepositoryManager( llrm );
}
private LegacyLocalRepositoryManager( ArtifactRepository delegate )

View File

@ -21,7 +21,7 @@ package org.apache.maven.classrealm;
import java.io.File;
import org.sonatype.aether.artifact.Artifact;
import org.eclipse.aether.artifact.Artifact;
/**
* @author Benjamin Bentmann

View File

@ -25,7 +25,7 @@ import java.util.Map;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.sonatype.aether.artifact.Artifact;
import org.eclipse.aether.artifact.Artifact;
/**
* Manages the class realms used by Maven. <strong>Warning:</strong> This is an internal utility interface that is only

View File

@ -45,7 +45,7 @@ import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.aether.artifact.Artifact;
import org.eclipse.aether.artifact.Artifact;
/**
* Manages the class realms used by Maven. <strong>Warning:</strong> This is an internal utility class that is only
@ -163,19 +163,19 @@ public class DefaultClassRealmManager
imports.put( "org.apache.maven.wagon.resource", coreRealm );
// aether-api, aether-spi, aether-impl
imports.put( "org.sonatype.aether.*", coreRealm );
imports.put( "org.sonatype.aether.artifact", coreRealm );
imports.put( "org.sonatype.aether.collection", coreRealm );
imports.put( "org.sonatype.aether.deployment", coreRealm );
imports.put( "org.sonatype.aether.graph", coreRealm );
imports.put( "org.sonatype.aether.impl", coreRealm );
imports.put( "org.sonatype.aether.installation", coreRealm );
imports.put( "org.sonatype.aether.metadata", coreRealm );
imports.put( "org.sonatype.aether.repository", coreRealm );
imports.put( "org.sonatype.aether.resolution", coreRealm );
imports.put( "org.sonatype.aether.spi", coreRealm );
imports.put( "org.sonatype.aether.transfer", coreRealm );
imports.put( "org.sonatype.aether.version", coreRealm );
imports.put( "org.eclipse.aether.*", coreRealm );
imports.put( "org.eclipse.aether.artifact", coreRealm );
imports.put( "org.eclipse.aether.collection", coreRealm );
imports.put( "org.eclipse.aether.deployment", coreRealm );
imports.put( "org.eclipse.aether.graph", coreRealm );
imports.put( "org.eclipse.aether.impl", coreRealm );
imports.put( "org.eclipse.aether.installation", coreRealm );
imports.put( "org.eclipse.aether.metadata", coreRealm );
imports.put( "org.eclipse.aether.repository", coreRealm );
imports.put( "org.eclipse.aether.resolution", coreRealm );
imports.put( "org.eclipse.aether.spi", coreRealm );
imports.put( "org.eclipse.aether.transfer", coreRealm );
imports.put( "org.eclipse.aether.version", coreRealm );
// plexus-classworlds
imports.put( "org.codehaus.plexus.classworlds", coreRealm );

View File

@ -62,7 +62,7 @@ public interface EventSpy
* @see org.apache.maven.project.DependencyResolutionRequest
* @see org.apache.maven.project.DependencyResolutionResultt
* @see org.apache.maven.execution.ExecutionEvent
* @see org.sonatype.aether.RepositoryEvent
* @see org.eclipse.aether.RepositoryEvent
*/
void onEvent( Object event )
throws Exception;

View File

@ -27,7 +27,7 @@ import org.apache.maven.execution.ExecutionListener;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.RepositoryListener;
import org.eclipse.aether.RepositoryListener;
/**
* Dispatches callbacks to all registered eventspies.

View File

@ -19,9 +19,9 @@ package org.apache.maven.eventspy.internal;
* under the License.
*/
import org.sonatype.aether.AbstractRepositoryListener;
import org.sonatype.aether.RepositoryEvent;
import org.sonatype.aether.RepositoryListener;
import org.eclipse.aether.AbstractRepositoryListener;
import org.eclipse.aether.RepositoryEvent;
import org.eclipse.aether.RepositoryListener;
/**
* Forwards repository events to eventspies.

View File

@ -32,10 +32,10 @@ import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.sonatype.aether.RepositoryCache;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.transfer.TransferListener;
import org.sonatype.aether.util.DefaultRepositoryCache;
import org.eclipse.aether.DefaultRepositoryCache;
import org.eclipse.aether.RepositoryCache;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.transfer.TransferListener;
/**
* @author Jason van Zyl

View File

@ -32,9 +32,9 @@ import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.RepositoryCache;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.transfer.TransferListener;
import org.eclipse.aether.RepositoryCache;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.transfer.TransferListener;
/**
* @author Jason van Zyl

View File

@ -36,7 +36,7 @@ import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.sonatype.aether.RepositorySystemSession;
import org.eclipse.aether.RepositorySystemSession;
/**
* @author Jason van Zyl

View File

@ -31,11 +31,11 @@ import org.apache.maven.project.artifact.InvalidDependencyVersionException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.graph.Dependency;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.util.filter.AndDependencyFilter;
import org.sonatype.aether.util.filter.ScopeDependencyFilter;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.util.filter.AndDependencyFilter;
import org.eclipse.aether.util.filter.ScopeDependencyFilter;
import java.util.*;
@ -227,7 +227,7 @@ public class LifecycleDependencyResolver
for ( Dependency dependency : dependencies )
{
org.sonatype.aether.artifact.Artifact a = dependency.getArtifact();
org.eclipse.aether.artifact.Artifact a = dependency.getArtifact();
String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() );
if ( !projectKeys.contains( key ) )
{
@ -309,7 +309,7 @@ public class LifecycleDependencyResolver
Dependency dependency = node.getDependency();
if ( dependency != null )
{
org.sonatype.aether.artifact.Artifact a = dependency.getArtifact();
org.eclipse.aether.artifact.Artifact a = dependency.getArtifact();
String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() );
return !keys.contains( key );
}

View File

@ -22,8 +22,8 @@ import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
/**
* @author Jason van Zyl

View File

@ -25,11 +25,11 @@ import java.util.List;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Exclusion;
import org.apache.maven.model.Plugin;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.RepositoryPolicy;
import org.sonatype.aether.repository.WorkspaceReader;
import org.sonatype.aether.repository.WorkspaceRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.RepositoryPolicy;
import org.eclipse.aether.repository.WorkspaceReader;
import org.eclipse.aether.repository.WorkspaceRepository;
/**
* @author Benjamin Bentmann

View File

@ -27,8 +27,8 @@ import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
// TODO: the antrun plugin has its own configurator, the only plugin that does. might need to think about how that works
// TODO: remove the coreArtifactFilterManager

View File

@ -29,7 +29,7 @@ import org.apache.maven.project.ExtensionDescriptor;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.aether.artifact.Artifact;
import org.eclipse.aether.artifact.Artifact;
/**
* Default extension realm cache implementation. Assumes cached data does not change.

View File

@ -28,12 +28,12 @@ import java.util.Map;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.WorkspaceRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.WorkspaceRepository;
/**
* @author Igor Fedorenko

View File

@ -30,10 +30,10 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.repository.ComponentDescriptor;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.WorkspaceRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.WorkspaceRepository;
/**
* Caches raw plugin descriptors. A raw plugin descriptor is a descriptor that has just been extracted from the plugin

View File

@ -32,11 +32,11 @@ import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.WorkspaceRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.WorkspaceRepository;
/**
* Default PluginCache implementation. Assumes cached data does not change.

View File

@ -24,7 +24,7 @@ import java.util.List;
import org.apache.maven.project.ExtensionDescriptor;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.sonatype.aether.artifact.Artifact;
import org.eclipse.aether.artifact.Artifact;
/**
* Caches extension class realms. <strong>Warning:</strong> This is an internal utility interface that is only public

View File

@ -20,7 +20,7 @@ package org.apache.maven.plugin;
*/
import org.apache.maven.execution.MavenSession;
import org.sonatype.aether.RepositorySystemSession;
import org.eclipse.aether.RepositorySystemSession;
/**
* Helps to provide backward-compatibility with plugins that use legacy components. <strong>Warning:</strong> This is an

View File

@ -25,9 +25,9 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Provides basic services to manage Maven plugins and their mojos. This component is kept general in its design such

View File

@ -23,10 +23,10 @@ import java.util.List;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Caches plugin artifacts. <strong>Warning:</strong> This is an internal utility interface that is only public for

View File

@ -23,8 +23,8 @@ import java.util.List;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Caches raw plugin descriptors. A raw plugin descriptor is a descriptor that has just been extracted from the plugin

View File

@ -26,9 +26,9 @@ import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Caches plugin class realms. <strong>Warning:</strong> This is an internal utility interface that is only public for

View File

@ -22,7 +22,7 @@ package org.apache.maven.plugin.internal;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.LegacySupport;
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.aether.RepositorySystemSession;
import org.eclipse.aether.RepositorySystemSession;
/**
* Helps to provide backward-compatibility with plugins that use legacy components. <strong>Warning:</strong> This is an

View File

@ -87,12 +87,12 @@ import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.filter.AndDependencyFilter;
import org.sonatype.aether.util.graph.PreorderNodeListGenerator;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.util.filter.AndDependencyFilter;
import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator;
/**
* Provides basic services to manage Maven plugins and their mojos. This component is kept general in its design such
@ -139,7 +139,7 @@ public class DefaultMavenPluginManager
if ( pluginDescriptor == null )
{
org.sonatype.aether.artifact.Artifact artifact =
org.eclipse.aether.artifact.Artifact artifact =
pluginDependenciesResolver.resolve( plugin, repositories, session );
Artifact pluginArtifact = RepositoryUtils.toArtifact( artifact );
@ -369,7 +369,7 @@ public class DefaultMavenPluginManager
}
}
List<org.sonatype.aether.artifact.Artifact> pluginArtifacts = nlg.getArtifacts( true );
List<org.eclipse.aether.artifact.Artifact> pluginArtifacts = nlg.getArtifacts( true );
ClassRealm pluginRealm =
classRealmManager.createPluginRealm( plugin, parent, null, foreignImports, pluginArtifacts );

View File

@ -31,35 +31,34 @@ import org.apache.maven.plugin.PluginResolutionException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.collection.CollectRequest;
import org.sonatype.aether.collection.DependencyCollectionException;
import org.sonatype.aether.collection.DependencyGraphTransformer;
import org.sonatype.aether.collection.DependencySelector;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.graph.DependencyVisitor;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.resolution.ArtifactDescriptorException;
import org.sonatype.aether.resolution.ArtifactDescriptorRequest;
import org.sonatype.aether.resolution.ArtifactDescriptorResult;
import org.sonatype.aether.resolution.ArtifactRequest;
import org.sonatype.aether.resolution.ArtifactResolutionException;
import org.sonatype.aether.resolution.DependencyRequest;
import org.sonatype.aether.resolution.DependencyResolutionException;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.FilterRepositorySystemSession;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.JavaScopes;
import org.sonatype.aether.util.filter.AndDependencyFilter;
import org.sonatype.aether.util.filter.ExclusionsDependencyFilter;
import org.sonatype.aether.util.filter.ScopeDependencyFilter;
import org.sonatype.aether.util.graph.selector.AndDependencySelector;
import org.sonatype.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.collection.DependencyCollectionException;
import org.eclipse.aether.collection.DependencyGraphTransformer;
import org.eclipse.aether.collection.DependencySelector;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.graph.DependencyVisitor;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.resolution.ArtifactDescriptorException;
import org.eclipse.aether.resolution.ArtifactDescriptorRequest;
import org.eclipse.aether.resolution.ArtifactDescriptorResult;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.DependencyRequest;
import org.eclipse.aether.resolution.DependencyResolutionException;
import org.eclipse.aether.util.artifact.JavaScopes;
import org.eclipse.aether.util.filter.AndDependencyFilter;
import org.eclipse.aether.util.filter.ExclusionsDependencyFilter;
import org.eclipse.aether.util.filter.ScopeDependencyFilter;
import org.eclipse.aether.util.graph.selector.AndDependencySelector;
import org.eclipse.aether.util.graph.transformer.ChainedDependencyGraphTransformer;
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
/**
* Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility class that
@ -94,20 +93,14 @@ public class DefaultPluginDependenciesResolver
public Artifact resolve( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session )
throws PluginResolutionException
{
RequestTrace trace = DefaultRequestTrace.newChild( null, plugin );
RequestTrace trace = RequestTrace.newChild( null, plugin );
Artifact pluginArtifact = toArtifact( plugin, session );
try
{
RepositorySystemSession pluginSession = new FilterRepositorySystemSession( session )
{
@Override
public boolean isIgnoreMissingArtifactDescriptor()
{
return false;
}
};
DefaultRepositorySystemSession pluginSession = new DefaultRepositorySystemSession( session );
pluginSession.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, false ) );
ArtifactDescriptorRequest request =
new ArtifactDescriptorRequest( pluginArtifact, repositories, REPOSITORY_CONTEXT );
@ -147,7 +140,7 @@ public class DefaultPluginDependenciesResolver
List<RemoteRepository> repositories, RepositorySystemSession session )
throws PluginResolutionException
{
RequestTrace trace = DefaultRequestTrace.newChild( null, plugin );
RequestTrace trace = RequestTrace.newChild( null, plugin );
if ( pluginArtifact == null )
{
@ -179,10 +172,10 @@ public class DefaultPluginDependenciesResolver
CollectRequest request = new CollectRequest();
request.setRequestContext( REPOSITORY_CONTEXT );
request.setRepositories( repositories );
request.setRoot( new org.sonatype.aether.graph.Dependency( pluginArtifact, null ) );
request.setRoot( new org.eclipse.aether.graph.Dependency( pluginArtifact, null ) );
for ( Dependency dependency : plugin.getDependencies() )
{
org.sonatype.aether.graph.Dependency pluginDep =
org.eclipse.aether.graph.Dependency pluginDep =
RepositoryUtils.toDependency( dependency, session.getArtifactTypeRegistry() );
if ( !JavaScopes.SYSTEM.equals( pluginDep.getScope() ) )
{
@ -194,7 +187,7 @@ public class DefaultPluginDependenciesResolver
DependencyRequest depRequest = new DependencyRequest( request, resolutionFilter );
depRequest.setTrace( trace );
request.setTrace( DefaultRequestTrace.newChild( trace, depRequest ) );
request.setTrace( RequestTrace.newChild( trace, depRequest ) );
node = repoSystem.collectDependencies( pluginSession, request ).getRoot();
@ -228,23 +221,13 @@ public class DefaultPluginDependenciesResolver
{
StringBuilder buffer = new StringBuilder( 128 );
buffer.append( indent );
org.sonatype.aether.graph.Dependency dep = node.getDependency();
org.eclipse.aether.graph.Dependency dep = node.getDependency();
if ( dep != null )
{
org.sonatype.aether.artifact.Artifact art = dep.getArtifact();
org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
buffer.append( art );
buffer.append( ':' ).append( dep.getScope() );
if ( node.getPremanagedScope() != null && !node.getPremanagedScope().equals( dep.getScope() ) )
{
buffer.append( " (scope managed from " ).append( node.getPremanagedScope() ).append( ")" );
}
if ( node.getPremanagedVersion() != null && !node.getPremanagedVersion().equals( art.getVersion() ) )
{
buffer.append( " (version managed from " ).append( node.getPremanagedVersion() ).append( ")" );
}
}
logger.debug( buffer.toString() );

View File

@ -19,15 +19,15 @@ package org.apache.maven.plugin.internal;
* under the License.
*/
import org.sonatype.aether.RepositoryException;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.collection.DependencyGraphTransformationContext;
import org.sonatype.aether.collection.DependencyGraphTransformer;
import org.sonatype.aether.graph.Dependency;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.util.artifact.DefaultArtifact;
import org.sonatype.aether.util.artifact.JavaScopes;
import org.sonatype.aether.util.graph.DefaultDependencyNode;
import org.eclipse.aether.RepositoryException;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.collection.DependencyGraphTransformationContext;
import org.eclipse.aether.collection.DependencyGraphTransformer;
import org.eclipse.aether.graph.DefaultDependencyNode;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.util.artifact.JavaScopes;
/**
* Injects plexus-utils:1.1 into a plugin's class path if it doesn't already declare a dependency on plexus-utils. This

View File

@ -23,11 +23,11 @@ import java.util.List;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.PluginResolutionException;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Assists in resolving the dependencies of a plugin. <strong>Warning:</strong> This is an internal utility interface

View File

@ -19,10 +19,10 @@ package org.apache.maven.plugin.internal;
* under the License.
*/
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.collection.DependencyCollectionContext;
import org.sonatype.aether.collection.DependencySelector;
import org.sonatype.aether.graph.Dependency;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.collection.DependencyCollectionContext;
import org.eclipse.aether.collection.DependencySelector;
import org.eclipse.aether.graph.Dependency;
/**
* Assists in detecting wagon providers brought into the plugin class path via legacy Maven core artifacts (e.g.

View File

@ -25,8 +25,8 @@ import java.util.List;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Model;
import org.apache.maven.project.MavenProject;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Collects settings required to resolve a plugin prefix.

View File

@ -21,8 +21,8 @@ package org.apache.maven.plugin.prefix;
import java.util.List;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
public class NoPluginFoundForPrefixException
extends Exception

View File

@ -22,8 +22,8 @@ package org.apache.maven.plugin.prefix;
import java.util.List;
import org.apache.maven.model.Model;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Collects settings required to resolve a plugin prefix.

View File

@ -1,6 +1,6 @@
package org.apache.maven.plugin.prefix;
import org.sonatype.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.ArtifactRepository;
/*
* Licensed to the Apache Software Foundation (ASF) under one

View File

@ -38,20 +38,19 @@ import org.apache.maven.plugin.prefix.PluginPrefixResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.RepositoryEvent.EventType;
import org.sonatype.aether.RepositoryListener;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.repository.ArtifactRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.RepositoryPolicy;
import org.sonatype.aether.resolution.MetadataRequest;
import org.sonatype.aether.resolution.MetadataResult;
import org.sonatype.aether.util.DefaultRepositorySystemSession;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.listener.DefaultRepositoryEvent;
import org.sonatype.aether.util.metadata.DefaultMetadata;
import org.eclipse.aether.RepositoryEvent.EventType;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositoryEvent;
import org.eclipse.aether.RepositoryListener;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.metadata.DefaultMetadata;
import org.eclipse.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.RepositoryPolicy;
import org.eclipse.aether.resolution.MetadataRequest;
import org.eclipse.aether.resolution.MetadataResult;
/**
* Resolves a plugin prefix.
@ -163,13 +162,13 @@ public class DefaultPluginPrefixResolver
private PluginPrefixResult resolveFromRepository( PluginPrefixRequest request )
{
RequestTrace trace = DefaultRequestTrace.newChild( null, request );
RequestTrace trace = RequestTrace.newChild( null, request );
List<MetadataRequest> requests = new ArrayList<MetadataRequest>();
for ( String pluginGroup : request.getPluginGroups() )
{
org.sonatype.aether.metadata.Metadata metadata =
org.eclipse.aether.metadata.Metadata metadata =
new DefaultMetadata( pluginGroup, "maven-metadata.xml", DefaultMetadata.Nature.RELEASE_OR_SNAPSHOT );
requests.add( new MetadataRequest( metadata, null, REPOSITORY_CONTEXT ).setTrace( trace ) );
@ -213,7 +212,7 @@ public class DefaultPluginPrefixResolver
{
for ( MetadataResult res : results )
{
org.sonatype.aether.metadata.Metadata metadata = res.getMetadata();
org.eclipse.aether.metadata.Metadata metadata = res.getMetadata();
if ( metadata != null )
{
@ -243,7 +242,7 @@ public class DefaultPluginPrefixResolver
private PluginPrefixResult resolveFromRepository( PluginPrefixRequest request, RequestTrace trace,
String pluginGroup,
org.sonatype.aether.metadata.Metadata metadata,
org.eclipse.aether.metadata.Metadata metadata,
ArtifactRepository repository )
{
if ( metadata != null && metadata.getFile() != null && metadata.getFile().isFile() )
@ -277,17 +276,18 @@ public class DefaultPluginPrefixResolver
}
private void invalidMetadata( RepositorySystemSession session, RequestTrace trace,
org.sonatype.aether.metadata.Metadata metadata, ArtifactRepository repository,
org.eclipse.aether.metadata.Metadata metadata, ArtifactRepository repository,
Exception exception )
{
RepositoryListener listener = session.getRepositoryListener();
if ( listener != null )
{
DefaultRepositoryEvent event = new DefaultRepositoryEvent( EventType.METADATA_INVALID, session, trace );
RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
event.setTrace( trace );
event.setMetadata( metadata );
event.setException( exception );
event.setRepository( repository );
listener.metadataInvalid( event );
listener.metadataInvalid( event.build() );
}
}

View File

@ -21,7 +21,7 @@ package org.apache.maven.plugin.prefix.internal;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.prefix.PluginPrefixResult;
import org.sonatype.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.ArtifactRepository;
/**
* Describes the result of a plugin prefix resolution request.

View File

@ -26,8 +26,8 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Collects settings required to resolve the version for a plugin.

View File

@ -22,8 +22,8 @@ package org.apache.maven.plugin.version;
import java.util.List;
import org.apache.maven.model.Model;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;
/**
* Collects settings required to resolve the version for a plugin.

View File

@ -21,8 +21,8 @@ package org.apache.maven.plugin.version;
import java.util.List;
import org.sonatype.aether.repository.LocalRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
public class PluginVersionResolutionException
extends Exception

View File

@ -19,7 +19,7 @@ package org.apache.maven.plugin.version;
* under the License.
*/
import org.sonatype.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.ArtifactRepository;
/**
* Describes the result of a plugin version resolution request.

View File

@ -43,22 +43,21 @@ import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.aether.RepositoryEvent.EventType;
import org.sonatype.aether.RepositoryListener;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.repository.ArtifactRepository;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.resolution.MetadataRequest;
import org.sonatype.aether.resolution.MetadataResult;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.listener.DefaultRepositoryEvent;
import org.sonatype.aether.util.metadata.DefaultMetadata;
import org.sonatype.aether.util.version.GenericVersionScheme;
import org.sonatype.aether.version.InvalidVersionSpecificationException;
import org.sonatype.aether.version.Version;
import org.sonatype.aether.version.VersionScheme;
import org.eclipse.aether.RepositoryEvent.EventType;
import org.eclipse.aether.RepositoryEvent;
import org.eclipse.aether.RepositoryListener;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.metadata.DefaultMetadata;
import org.eclipse.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.resolution.MetadataRequest;
import org.eclipse.aether.resolution.MetadataResult;
import org.eclipse.aether.util.version.GenericVersionScheme;
import org.eclipse.aether.version.InvalidVersionSpecificationException;
import org.eclipse.aether.version.Version;
import org.eclipse.aether.version.VersionScheme;
/**
* Resolves a version for a plugin.
@ -114,11 +113,11 @@ public class DefaultPluginVersionResolver
private PluginVersionResult resolveFromRepository( PluginVersionRequest request )
throws PluginVersionResolutionException
{
RequestTrace trace = DefaultRequestTrace.newChild( null, request );
RequestTrace trace = RequestTrace.newChild( null, request );
DefaultPluginVersionResult result = new DefaultPluginVersionResult();
org.sonatype.aether.metadata.Metadata metadata =
org.eclipse.aether.metadata.Metadata metadata =
new DefaultMetadata( request.getGroupId(), request.getArtifactId(), "maven-metadata.xml",
DefaultMetadata.Nature.RELEASE_OR_SNAPSHOT );
@ -280,7 +279,7 @@ public class DefaultPluginVersionResolver
}
private void mergeMetadata( RepositorySystemSession session, RequestTrace trace, Versions versions,
org.sonatype.aether.metadata.Metadata metadata, ArtifactRepository repository )
org.eclipse.aether.metadata.Metadata metadata, ArtifactRepository repository )
{
if ( metadata != null && metadata.getFile() != null && metadata.getFile().isFile() )
{
@ -300,17 +299,18 @@ public class DefaultPluginVersionResolver
}
private void invalidMetadata( RepositorySystemSession session, RequestTrace trace,
org.sonatype.aether.metadata.Metadata metadata, ArtifactRepository repository,
org.eclipse.aether.metadata.Metadata metadata, ArtifactRepository repository,
Exception exception )
{
RepositoryListener listener = session.getRepositoryListener();
if ( listener != null )
{
DefaultRepositoryEvent event = new DefaultRepositoryEvent( EventType.METADATA_INVALID, session, trace );
RepositoryEvent.Builder event = new RepositoryEvent.Builder( session, EventType.METADATA_INVALID );
event.setTrace( trace );
event.setMetadata( metadata );
event.setException( exception );
event.setRepository( repository );
listener.metadataInvalid( event );
listener.metadataInvalid( event.build() );
}
}

View File

@ -20,7 +20,7 @@ package org.apache.maven.plugin.version.internal;
*/
import org.apache.maven.plugin.version.PluginVersionResult;
import org.sonatype.aether.repository.ArtifactRepository;
import org.eclipse.aether.repository.ArtifactRepository;
/**
* Describes the result of a plugin version resolution request.

View File

@ -19,8 +19,8 @@ package org.apache.maven.project;
* under the License.
*/
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.graph.DependencyFilter;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.graph.DependencyFilter;
/**
* @author Benjamin Bentmann

View File

@ -25,8 +25,8 @@ import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import org.sonatype.aether.graph.Dependency;
import org.sonatype.aether.graph.DependencyNode;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.DependencyNode;
/**
* @author Benjamin Bentmann

View File

@ -51,15 +51,14 @@ import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.Os;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.impl.RemoteRepositoryManager;
import org.sonatype.aether.repository.LocalRepositoryManager;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.repository.WorkspaceRepository;
import org.sonatype.aether.resolution.ArtifactRequest;
import org.sonatype.aether.resolution.ArtifactResult;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.impl.RemoteRepositoryManager;
import org.eclipse.aether.repository.LocalRepositoryManager;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.repository.WorkspaceRepository;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResult;
/**
*/
@ -84,7 +83,7 @@ public class DefaultProjectBuilder
private RepositorySystem repositorySystem;
@Requirement
private org.sonatype.aether.RepositorySystem repoSystem;
private org.eclipse.aether.RepositorySystem repoSystem;
@Requirement
private RemoteRepositoryManager repositoryManager;
@ -241,7 +240,7 @@ public class DefaultProjectBuilder
ModelBuildingRequest request = new DefaultModelBuildingRequest();
RequestTrace trace = DefaultRequestTrace.newChild( null, configuration ).newChild( request );
RequestTrace trace = RequestTrace.newChild( null, configuration ).newChild( request );
ModelResolver resolver =
new ProjectModelResolver( config.session, trace, repoSystem, repositoryManager, config.repositories,
@ -270,7 +269,7 @@ public class DefaultProjectBuilder
public ProjectBuildingResult build( Artifact artifact, boolean allowStubModel, ProjectBuildingRequest request )
throws ProjectBuildingException
{
org.sonatype.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact( artifact );
org.eclipse.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact( artifact );
pomArtifact = ArtifactDescriptorUtils.toPomArtifact( pomArtifact );
InternalConfig config = new InternalConfig( request, null );
@ -287,7 +286,7 @@ public class DefaultProjectBuilder
pomArtifact = pomResult.getArtifact();
localProject = pomResult.getRepository() instanceof WorkspaceRepository;
}
catch ( org.sonatype.aether.resolution.ArtifactResolutionException e )
catch ( org.eclipse.aether.resolution.ArtifactResolutionException e )
{
if ( e.getResults().get( 0 ).isMissing() && allowStubModel )
{

View File

@ -52,12 +52,12 @@ import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.filter.ExclusionsDependencyFilter;
import org.sonatype.aether.util.graph.PreorderNodeListGenerator;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.util.filter.ExclusionsDependencyFilter;
import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator;
/**
* Assists the project builder. <strong>Warning:</strong> This is an internal utility class that is only public for

View File

@ -27,7 +27,7 @@ import java.util.Properties;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Profile;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.sonatype.aether.RepositorySystemSession;
import org.eclipse.aether.RepositorySystemSession;
public class DefaultProjectBuildingRequest
implements ProjectBuildingRequest

View File

@ -34,22 +34,23 @@ import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.StringUtils;
import org.sonatype.aether.RepositorySystem;
import org.sonatype.aether.RepositorySystemSession;
import org.sonatype.aether.RequestTrace;
import org.sonatype.aether.artifact.ArtifactType;
import org.sonatype.aether.artifact.ArtifactTypeRegistry;
import org.sonatype.aether.collection.CollectRequest;
import org.sonatype.aether.collection.DependencyCollectionException;
import org.sonatype.aether.graph.DependencyFilter;
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.graph.DependencyVisitor;
import org.sonatype.aether.resolution.ArtifactResult;
import org.sonatype.aether.resolution.DependencyRequest;
import org.sonatype.aether.util.DefaultRequestTrace;
import org.sonatype.aether.util.artifact.ArtifacIdUtils;
import org.sonatype.aether.util.artifact.ArtifactProperties;
import org.sonatype.aether.util.artifact.JavaScopes;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.RequestTrace;
import org.eclipse.aether.artifact.ArtifactProperties;
import org.eclipse.aether.artifact.ArtifactType;
import org.eclipse.aether.artifact.ArtifactTypeRegistry;
import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.collection.DependencyCollectionException;
import org.eclipse.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.graph.DependencyVisitor;
import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.resolution.DependencyRequest;
import org.eclipse.aether.util.artifact.ArtifactIdUtils;
import org.eclipse.aether.util.artifact.JavaScopes;
import org.eclipse.aether.util.graph.manager.DependencyManagerUtils;
/**
* @author Benjamin Bentmann
@ -68,17 +69,25 @@ public class DefaultProjectDependenciesResolver
public DependencyResolutionResult resolve( DependencyResolutionRequest request )
throws DependencyResolutionException
{
RequestTrace trace = DefaultRequestTrace.newChild( null, request );
RequestTrace trace = RequestTrace.newChild( null, request );
DefaultDependencyResolutionResult result = new DefaultDependencyResolutionResult();
MavenProject project = request.getMavenProject();
RepositorySystemSession session = request.getRepositorySession();
if ( logger.isDebugEnabled()
&& session.getConfigProperties().get( DependencyManagerUtils.CONFIG_PROP_VERBOSE ) == null )
{
DefaultRepositorySystemSession verbose = new DefaultRepositorySystemSession( session );
verbose.setConfigProperty( DependencyManagerUtils.CONFIG_PROP_VERBOSE, Boolean.TRUE );
session = verbose;
}
DependencyFilter filter = request.getResolutionFilter();
ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry();
CollectRequest collect = new CollectRequest();
collect.setRootArtifact( RepositoryUtils.toArtifact( project.getArtifact() ) );
collect.setRequestContext( "project" );
collect.setRepositories( project.getRemoteProjectRepositories() );
@ -110,7 +119,7 @@ public class DefaultProjectDependenciesResolver
}
}
String key =
ArtifacIdUtils.toVersionlessId( dependency.getGroupId(), dependency.getArtifactId(),
ArtifactIdUtils.toVersionlessId( dependency.getGroupId(), dependency.getArtifactId(),
dependency.getType(), classifier );
dependencies.put( key, dependency );
}
@ -119,11 +128,11 @@ public class DefaultProjectDependenciesResolver
String key = artifact.getDependencyConflictId();
Dependency dependency = dependencies.get( key );
Collection<Exclusion> exclusions = dependency != null ? dependency.getExclusions() : null;
org.sonatype.aether.graph.Dependency dep = RepositoryUtils.toDependency( artifact, exclusions );
org.eclipse.aether.graph.Dependency dep = RepositoryUtils.toDependency( artifact, exclusions );
if ( !JavaScopes.SYSTEM.equals( dep.getScope() ) && dep.getArtifact().getFile() != null )
{
// enable re-resolution
org.sonatype.aether.artifact.Artifact art = dep.getArtifact();
org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
art = art.setFile( null ).setVersion( art.getBaseVersion() );
dep = dep.setArtifact( art );
}
@ -146,7 +155,7 @@ public class DefaultProjectDependenciesResolver
DependencyNode node;
try
{
collect.setTrace( DefaultRequestTrace.newChild( trace, depRequest ) );
collect.setTrace( RequestTrace.newChild( trace, depRequest ) );
node = repoSystem.collectDependencies( session, collect ).getRoot();
result.setDependencyGraph( node );
}
@ -182,7 +191,7 @@ public class DefaultProjectDependenciesResolver
{
process( result, repoSystem.resolveDependencies( session, depRequest ).getArtifactResults() );
}
catch ( org.sonatype.aether.resolution.DependencyResolutionException e )
catch ( org.eclipse.aether.resolution.DependencyResolutionException e )
{
process( result, e.getResult().getArtifactResults() );
@ -228,24 +237,26 @@ public class DefaultProjectDependenciesResolver
{
StringBuilder buffer = new StringBuilder( 128 );
buffer.append( indent );
org.sonatype.aether.graph.Dependency dep = node.getDependency();
org.eclipse.aether.graph.Dependency dep = node.getDependency();
if ( dep != null )
{
org.sonatype.aether.artifact.Artifact art = dep.getArtifact();
org.eclipse.aether.artifact.Artifact art = dep.getArtifact();
buffer.append( art );
buffer.append( ':' ).append( dep.getScope() );
if ( node.getPremanagedScope() != null && !node.getPremanagedScope().equals( dep.getScope() ) )
String premanagedScope = DependencyManagerUtils.getPremanagedScope( node );
if ( premanagedScope != null && !premanagedScope.equals( dep.getScope() ) )
{
buffer.append( " (scope managed from " ).append( node.getPremanagedScope() );
buffer.append( " (scope managed from " ).append( premanagedScope );
appendManagementSource( buffer, art, "scope" );
buffer.append( ")" );
}
if ( node.getPremanagedVersion() != null && !node.getPremanagedVersion().equals( art.getVersion() ) )
String premanagedVersion = DependencyManagerUtils.getPremanagedVersion( node );
if ( premanagedVersion != null && !premanagedVersion.equals( art.getVersion() ) )
{
buffer.append( " (version managed from " ).append( node.getPremanagedVersion() );
buffer.append( " (version managed from " ).append( premanagedVersion );
appendManagementSource( buffer, art, "version" );
buffer.append( ")" );
}
@ -269,7 +280,7 @@ public class DefaultProjectDependenciesResolver
return true;
}
private void appendManagementSource( StringBuilder buffer, org.sonatype.aether.artifact.Artifact artifact,
private void appendManagementSource( StringBuilder buffer, org.eclipse.aether.artifact.Artifact artifact,
String field )
{
if ( managed == null )
@ -285,7 +296,7 @@ public class DefaultProjectDependenciesResolver
}
String key =
ArtifacIdUtils.toVersionlessId( artifact.getGroupId(), artifact.getArtifactId(),
ArtifactIdUtils.toVersionlessId( artifact.getGroupId(), artifact.getArtifactId(),
artifact.getProperty( ArtifactProperties.TYPE, "jar" ),
artifact.getClassifier() );

View File

@ -26,7 +26,7 @@ import java.util.Map;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.aether.graph.DependencyFilter;
import org.eclipse.aether.graph.DependencyFilter;
/**
* Default project realm cache implementation. Assumes cached data does not change.

Some files were not shown because too many files have changed in this diff Show More