Class LegacyRepositorySystem
- java.lang.Object
-
- org.apache.maven.repository.legacy.LegacyRepositorySystem
-
- All Implemented Interfaces:
RepositorySystem
@Component(role=RepositorySystem.class, hint="default") public class LegacyRepositorySystem extends java.lang.Object implements RepositorySystem
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classLegacyRepositorySystem.UnknownRepositoryLayoutIn the future, the legacy system might encounter repository types for which no layout components exists because the actual communication with the repository happens via a repository connector.
-
Field Summary
Fields Modifier and Type Field Description private ArtifactFactoryartifactFactoryprivate ArtifactRepositoryFactoryartifactRepositoryFactoryprivate ArtifactResolverartifactResolverprivate java.util.Map<java.lang.String,ArtifactRepositoryLayout>layoutsprivate org.codehaus.plexus.logging.Loggerloggerprivate MirrorSelectormirrorSelectorprivate org.codehaus.plexus.PlexusContainerplexusprivate SettingsDecryptersettingsDecrypterprivate WagonManagerwagonManager-
Fields inherited from interface org.apache.maven.repository.RepositorySystem
DEFAULT_LOCAL_REPO_ID, DEFAULT_REMOTE_REPO_ID, DEFAULT_REMOTE_REPO_URL, defaultUserLocalRepository, userHome, userMavenConfigurationHome
-
-
Constructor Summary
Constructors Constructor Description LegacyRepositorySystem()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ArtifactRepositorybuildArtifactRepository(Repository repo)ArtifactRepositoryPolicybuildArtifactRepositoryPolicy(RepositoryPolicy policy)private java.lang.StringcanonicalFileUrl(java.lang.String url)ArtifactcreateArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String packaging)ArtifactcreateArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String scope, java.lang.String type)ArtifactRepositorycreateArtifactRepository(java.lang.String repositoryId, java.lang.String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases)ArtifactcreateArtifactWithClassifier(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String type, java.lang.String classifier)ArtifactRepositorycreateDefaultLocalRepository()ArtifactRepositorycreateDefaultRemoteRepository()ArtifactcreateDependencyArtifact(Dependency d)ArtifactcreateExtensionArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)ArtifactRepositorycreateLocalRepository(java.io.File localRepository)ArtifactRepositorycreateLocalRepository(java.lang.String url, java.lang.String repositoryId)ArtifactcreateParentArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)ArtifactcreatePluginArtifact(Plugin plugin)ArtifactcreateProjectArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String metaVersionId)private ArtifactRepositorycreateRepository(java.lang.String url, java.lang.String repositoryId, boolean releases, java.lang.String releaseUpdates, boolean snapshots, java.lang.String snapshotUpdates, java.lang.String checksumPolicy)private AuthenticationgetAuthentication(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository)private ArtifactRepositoryPolicygetEffectivePolicy(java.util.Collection<ArtifactRepositoryPolicy> policies)java.util.List<ArtifactRepository>getEffectiveRepositories(java.util.List<ArtifactRepository> repositories)Calculates the effective repositories for the given input repositories which are assumed to be already mirrored (if applicable).private ArtifactRepositoryLayoutgetLayout(java.lang.String id)private static java.lang.StringgetMessage(java.lang.Throwable error, java.lang.String def)MirrorgetMirror(ArtifactRepository repository, java.util.List<Mirror> mirrors)Determines the mirror for the specified repository.private MirrorgetMirror(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository)private ProxygetProxy(ArtifactRepository repository, java.util.List<Proxy> proxies)private ProxygetProxy(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository)voidinjectAuthentication(java.util.List<ArtifactRepository> repositories, java.util.List<Server> servers)Injects the authentication information into the specified repositories.voidinjectAuthentication(org.eclipse.aether.RepositorySystemSession session, java.util.List<ArtifactRepository> repositories)voidinjectMirror(java.util.List<ArtifactRepository> repositories, java.util.List<Mirror> mirrors)Injects the mirroring information into the specified repositories.private voidinjectMirror(ArtifactRepository repository, Mirror mirror)voidinjectMirror(org.eclipse.aether.RepositorySystemSession session, java.util.List<ArtifactRepository> repositories)voidinjectProxy(java.util.List<ArtifactRepository> repositories, java.util.List<Proxy> proxies)Injects the proxy information into the specified repositories.voidinjectProxy(org.eclipse.aether.RepositorySystemSession session, java.util.List<ArtifactRepository> repositories)voidpublish(ArtifactRepository repository, java.io.File source, java.lang.String remotePath, ArtifactTransferListener transferListener)ArtifactResolutionResultresolve(ArtifactResolutionRequest request)voidretrieve(ArtifactRepository repository, java.io.File destination, java.lang.String remotePath, ArtifactTransferListener transferListener)
-
-
-
Field Detail
-
logger
@Requirement private org.codehaus.plexus.logging.Logger logger
-
artifactFactory
@Requirement private ArtifactFactory artifactFactory
-
artifactResolver
@Requirement private ArtifactResolver artifactResolver
-
artifactRepositoryFactory
@Requirement private ArtifactRepositoryFactory artifactRepositoryFactory
-
layouts
@Requirement(role=ArtifactRepositoryLayout.class) private java.util.Map<java.lang.String,ArtifactRepositoryLayout> layouts
-
wagonManager
@Requirement private WagonManager wagonManager
-
plexus
@Requirement private org.codehaus.plexus.PlexusContainer plexus
-
mirrorSelector
@Requirement private MirrorSelector mirrorSelector
-
settingsDecrypter
@Requirement private SettingsDecrypter settingsDecrypter
-
-
Method Detail
-
createArtifact
public Artifact createArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String scope, java.lang.String type)
- Specified by:
createArtifactin interfaceRepositorySystem
-
createArtifact
public Artifact createArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String packaging)
- Specified by:
createArtifactin interfaceRepositorySystem
-
createArtifactWithClassifier
public Artifact createArtifactWithClassifier(java.lang.String groupId, java.lang.String artifactId, java.lang.String version, java.lang.String type, java.lang.String classifier)
- Specified by:
createArtifactWithClassifierin interfaceRepositorySystem
-
createProjectArtifact
public Artifact createProjectArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String metaVersionId)
- Specified by:
createProjectArtifactin interfaceRepositorySystem
-
createDependencyArtifact
public Artifact createDependencyArtifact(Dependency d)
- Specified by:
createDependencyArtifactin interfaceRepositorySystem
-
createExtensionArtifact
public Artifact createExtensionArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
-
createParentArtifact
public Artifact createParentArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
-
createPluginArtifact
public Artifact createPluginArtifact(Plugin plugin)
- Specified by:
createPluginArtifactin interfaceRepositorySystem
-
buildArtifactRepositoryPolicy
public ArtifactRepositoryPolicy buildArtifactRepositoryPolicy(RepositoryPolicy policy)
-
createDefaultLocalRepository
public ArtifactRepository createDefaultLocalRepository() throws InvalidRepositoryException
- Specified by:
createDefaultLocalRepositoryin interfaceRepositorySystem- Throws:
InvalidRepositoryException
-
createLocalRepository
public ArtifactRepository createLocalRepository(java.io.File localRepository) throws InvalidRepositoryException
- Specified by:
createLocalRepositoryin interfaceRepositorySystem- Throws:
InvalidRepositoryException
-
createDefaultRemoteRepository
public ArtifactRepository createDefaultRemoteRepository() throws InvalidRepositoryException
- Specified by:
createDefaultRemoteRepositoryin interfaceRepositorySystem- Throws:
InvalidRepositoryException
-
createLocalRepository
public ArtifactRepository createLocalRepository(java.lang.String url, java.lang.String repositoryId) throws java.io.IOException
- Throws:
java.io.IOException
-
canonicalFileUrl
private java.lang.String canonicalFileUrl(java.lang.String url) throws java.io.IOException- Throws:
java.io.IOException
-
resolve
public ArtifactResolutionResult resolve(ArtifactResolutionRequest request)
- Specified by:
resolvein interfaceRepositorySystem
-
getEffectiveRepositories
public java.util.List<ArtifactRepository> getEffectiveRepositories(java.util.List<ArtifactRepository> repositories)
Description copied from interface:RepositorySystemCalculates the effective repositories for the given input repositories which are assumed to be already mirrored (if applicable). This process will essentially remove duplicate repositories by merging them into one equivalent repository. It is worth to point out that merging does not simply choose one of the input repositories and discards the others but actually combines their possibly different policies.- Specified by:
getEffectiveRepositoriesin interfaceRepositorySystem- Parameters:
repositories- The original repositories, may benull.- Returns:
- The effective repositories or
nullif the input wasnull.
-
getEffectivePolicy
private ArtifactRepositoryPolicy getEffectivePolicy(java.util.Collection<ArtifactRepositoryPolicy> policies)
-
getMirror
public Mirror getMirror(ArtifactRepository repository, java.util.List<Mirror> mirrors)
Description copied from interface:RepositorySystemDetermines the mirror for the specified repository.- Specified by:
getMirrorin interfaceRepositorySystem- Parameters:
repository- The repository to determine the mirror for, must not benull.mirrors- The available mirrors, may benull.- Returns:
- The mirror specification for the repository or
nullif no mirror matched.
-
injectMirror
public void injectMirror(java.util.List<ArtifactRepository> repositories, java.util.List<Mirror> mirrors)
Description copied from interface:RepositorySystemInjects the mirroring information into the specified repositories. For each repository that is matched by a mirror, its URL and ID will be updated to match the values from the mirror specification. Repositories without a matching mirror will pass through unchanged. Note: This method must be called beforeRepositorySystem.injectAuthentication(List, List)or the repositories will end up with the wrong credentials.- Specified by:
injectMirrorin interfaceRepositorySystem- Parameters:
repositories- The repositories into which to inject the mirror information, may benull.mirrors- The available mirrors, may benull.
-
getMirror
private Mirror getMirror(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository)
-
injectMirror
public void injectMirror(org.eclipse.aether.RepositorySystemSession session, java.util.List<ArtifactRepository> repositories)- Specified by:
injectMirrorin interfaceRepositorySystem
-
injectMirror
private void injectMirror(ArtifactRepository repository, Mirror mirror)
-
injectAuthentication
public void injectAuthentication(java.util.List<ArtifactRepository> repositories, java.util.List<Server> servers)
Description copied from interface:RepositorySystemInjects the authentication information into the specified repositories. For each repository that is matched by a server, its credentials will be updated to match the values from the server specification. Repositories without a matching server will have their credentials cleared. Note: This method must be called afterRepositorySystem.injectMirror(List, List)or the repositories will end up with the wrong credentials.- Specified by:
injectAuthenticationin interfaceRepositorySystem- Parameters:
repositories- The repositories into which to inject the authentication information, may benull.servers- The available servers, may benull.
-
getAuthentication
private Authentication getAuthentication(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository)
-
injectAuthentication
public void injectAuthentication(org.eclipse.aether.RepositorySystemSession session, java.util.List<ArtifactRepository> repositories)- Specified by:
injectAuthenticationin interfaceRepositorySystem
-
getProxy
private Proxy getProxy(ArtifactRepository repository, java.util.List<Proxy> proxies)
-
injectProxy
public void injectProxy(java.util.List<ArtifactRepository> repositories, java.util.List<Proxy> proxies)
Description copied from interface:RepositorySystemInjects the proxy information into the specified repositories. For each repository that is matched by a proxy, its proxy data will be set accordingly. Repositories without a matching proxy will have their proxy cleared. Note: This method must be called afterRepositorySystem.injectMirror(List, List)or the repositories will end up with the wrong proxies.- Specified by:
injectProxyin interfaceRepositorySystem- Parameters:
repositories- The repositories into which to inject the proxy information, may benull.proxies- The available proxies, may benull.
-
getProxy
private Proxy getProxy(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository)
-
injectProxy
public void injectProxy(org.eclipse.aether.RepositorySystemSession session, java.util.List<ArtifactRepository> repositories)- Specified by:
injectProxyin interfaceRepositorySystem
-
retrieve
public void retrieve(ArtifactRepository repository, java.io.File destination, java.lang.String remotePath, ArtifactTransferListener transferListener) throws ArtifactTransferFailedException, ArtifactDoesNotExistException
- Specified by:
retrievein interfaceRepositorySystem- Throws:
ArtifactTransferFailedExceptionArtifactDoesNotExistException
-
publish
public void publish(ArtifactRepository repository, java.io.File source, java.lang.String remotePath, ArtifactTransferListener transferListener) throws ArtifactTransferFailedException
- Specified by:
publishin interfaceRepositorySystem- Throws:
ArtifactTransferFailedException
-
buildArtifactRepository
public ArtifactRepository buildArtifactRepository(Repository repo) throws InvalidRepositoryException
- Specified by:
buildArtifactRepositoryin interfaceRepositorySystem- Throws:
InvalidRepositoryException
-
createRepository
private ArtifactRepository createRepository(java.lang.String url, java.lang.String repositoryId, boolean releases, java.lang.String releaseUpdates, boolean snapshots, java.lang.String snapshotUpdates, java.lang.String checksumPolicy)
-
createArtifactRepository
public ArtifactRepository createArtifactRepository(java.lang.String repositoryId, java.lang.String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases)
- Specified by:
createArtifactRepositoryin interfaceRepositorySystem
-
getMessage
private static java.lang.String getMessage(java.lang.Throwable error, java.lang.String def)
-
getLayout
private ArtifactRepositoryLayout getLayout(java.lang.String id)
-
-