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 Object
implements RepositorySystem
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
In 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
FieldsModifier and TypeFieldDescriptionprivate ArtifactFactory
private ArtifactRepositoryFactory
private ArtifactResolver
private Map<String,
ArtifactRepositoryLayout> private org.codehaus.plexus.logging.Logger
private MirrorSelector
private org.codehaus.plexus.PlexusContainer
private SettingsDecrypter
private WagonManager
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 -
Method Summary
Modifier and TypeMethodDescriptionprivate String
canonicalFileUrl
(String url) createArtifact
(String groupId, String artifactId, String version, String packaging) createArtifactRepository
(String repositoryId, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases) createArtifactWithClassifier
(String groupId, String artifactId, String version, String type, String classifier) createExtensionArtifact
(String groupId, String artifactId, String version) createLocalRepository
(File localRepository) createLocalRepository
(String url, String repositoryId) createParentArtifact
(String groupId, String artifactId, String version) createPluginArtifact
(Plugin plugin) createProjectArtifact
(String groupId, String artifactId, String metaVersionId) private ArtifactRepository
createRepository
(String url, String repositoryId, boolean releases, String releaseUpdates, boolean snapshots, String snapshotUpdates, String checksumPolicy) private Authentication
getAuthentication
(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository) private ArtifactRepositoryPolicy
getEffectivePolicy
(Collection<ArtifactRepositoryPolicy> policies) getEffectiveRepositories
(List<ArtifactRepository> repositories) Calculates the effective repositories for the given input repositories which are assumed to be already mirrored (if applicable).private ArtifactRepositoryLayout
private static String
getMessage
(Throwable error, String def) getMirror
(ArtifactRepository repository, List<Mirror> mirrors) Determines the mirror for the specified repository.private Mirror
getMirror
(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository) private Proxy
getProxy
(ArtifactRepository repository, List<Proxy> proxies) private Proxy
getProxy
(org.eclipse.aether.RepositorySystemSession session, ArtifactRepository repository) void
injectAuthentication
(List<ArtifactRepository> repositories, List<Server> servers) Injects the authentication information into the specified repositories.void
injectAuthentication
(org.eclipse.aether.RepositorySystemSession session, List<ArtifactRepository> repositories) void
injectMirror
(List<ArtifactRepository> repositories, List<Mirror> mirrors) Injects the mirroring information into the specified repositories.private void
injectMirror
(ArtifactRepository repository, Mirror mirror) void
injectMirror
(org.eclipse.aether.RepositorySystemSession session, List<ArtifactRepository> repositories) void
injectProxy
(List<ArtifactRepository> repositories, List<Proxy> proxies) Injects the proxy information into the specified repositories.void
injectProxy
(org.eclipse.aether.RepositorySystemSession session, List<ArtifactRepository> repositories) void
publish
(ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener) resolve
(ArtifactResolutionRequest request) void
retrieve
(ArtifactRepository repository, File destination, String remotePath, ArtifactTransferListener transferListener)
-
Field Details
-
logger
@Requirement private org.codehaus.plexus.logging.Logger logger -
artifactFactory
-
artifactResolver
-
artifactRepositoryFactory
-
layouts
@Requirement(role=ArtifactRepositoryLayout.class) private Map<String,ArtifactRepositoryLayout> layouts -
wagonManager
-
plexus
@Requirement private org.codehaus.plexus.PlexusContainer plexus -
mirrorSelector
-
settingsDecrypter
-
-
Constructor Details
-
LegacyRepositorySystem
public LegacyRepositorySystem()
-
-
Method Details
-
createArtifact
public Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type) - Specified by:
createArtifact
in interfaceRepositorySystem
-
createArtifact
- Specified by:
createArtifact
in interfaceRepositorySystem
-
createArtifactWithClassifier
public Artifact createArtifactWithClassifier(String groupId, String artifactId, String version, String type, String classifier) - Specified by:
createArtifactWithClassifier
in interfaceRepositorySystem
-
createProjectArtifact
- Specified by:
createProjectArtifact
in interfaceRepositorySystem
-
createDependencyArtifact
- Specified by:
createDependencyArtifact
in interfaceRepositorySystem
-
createExtensionArtifact
-
createParentArtifact
-
createPluginArtifact
- Specified by:
createPluginArtifact
in interfaceRepositorySystem
-
buildArtifactRepositoryPolicy
-
createDefaultLocalRepository
- Specified by:
createDefaultLocalRepository
in interfaceRepositorySystem
- Throws:
InvalidRepositoryException
-
createLocalRepository
public ArtifactRepository createLocalRepository(File localRepository) throws InvalidRepositoryException - Specified by:
createLocalRepository
in interfaceRepositorySystem
- Throws:
InvalidRepositoryException
-
createDefaultRemoteRepository
- Specified by:
createDefaultRemoteRepository
in interfaceRepositorySystem
- Throws:
InvalidRepositoryException
-
createLocalRepository
- Throws:
IOException
-
canonicalFileUrl
- Throws:
IOException
-
resolve
- Specified by:
resolve
in interfaceRepositorySystem
-
getEffectiveRepositories
Description copied from interface:RepositorySystem
Calculates 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:
getEffectiveRepositories
in interfaceRepositorySystem
- Parameters:
repositories
- The original repositories, may benull
.- Returns:
- The effective repositories or
null
if the input wasnull
.
-
getEffectivePolicy
-
getMirror
Description copied from interface:RepositorySystem
Determines the mirror for the specified repository.- Specified by:
getMirror
in 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
null
if no mirror matched.
-
injectMirror
Description copied from interface:RepositorySystem
Injects 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:
injectMirror
in 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, List<ArtifactRepository> repositories) - Specified by:
injectMirror
in interfaceRepositorySystem
-
injectMirror
-
injectAuthentication
Description copied from interface:RepositorySystem
Injects 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:
injectAuthentication
in 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, List<ArtifactRepository> repositories) - Specified by:
injectAuthentication
in interfaceRepositorySystem
-
getProxy
-
injectProxy
Description copied from interface:RepositorySystem
Injects 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:
injectProxy
in 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, List<ArtifactRepository> repositories) - Specified by:
injectProxy
in interfaceRepositorySystem
-
retrieve
public void retrieve(ArtifactRepository repository, File destination, String remotePath, ArtifactTransferListener transferListener) throws ArtifactTransferFailedException, ArtifactDoesNotExistException - Specified by:
retrieve
in interfaceRepositorySystem
- Throws:
ArtifactTransferFailedException
ArtifactDoesNotExistException
-
publish
public void publish(ArtifactRepository repository, File source, String remotePath, ArtifactTransferListener transferListener) throws ArtifactTransferFailedException - Specified by:
publish
in interfaceRepositorySystem
- Throws:
ArtifactTransferFailedException
-
buildArtifactRepository
public ArtifactRepository buildArtifactRepository(Repository repo) throws InvalidRepositoryException - Specified by:
buildArtifactRepository
in interfaceRepositorySystem
- Throws:
InvalidRepositoryException
-
createRepository
-
createArtifactRepository
public ArtifactRepository createArtifactRepository(String repositoryId, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases) - Specified by:
createArtifactRepository
in interfaceRepositorySystem
-
getMessage
-
getLayout
-