Class GetMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.dependency.GetMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="get", requiresProject=false, threadSafe=true) public class GetMojo extends org.apache.maven.plugin.AbstractMojo
Resolves a single artifact, eventually transitively, from the specified remote repositories. Caveat: will always check the central repository defined in the super pom. You could use a mirror entry in yoursettings.xml
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.Pattern
ALT_REPO_SYNTAX_PATTERN
private java.lang.String
artifact
A string of the form groupId:artifactId:version[:packaging[:classifier]].private org.apache.maven.artifact.handler.manager.ArtifactHandlerManager
artifactHandlerManager
private java.lang.String
artifactId
The artifactId of the artifact to download.private org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver
artifactResolver
private java.lang.String
classifier
The classifier of the artifact to download.private org.apache.maven.shared.transfer.dependencies.DefaultDependableCoordinate
coordinate
private org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver
dependencyResolver
private java.lang.String
groupId
The groupId of the artifact to download.private java.lang.String
packaging
The packaging of the artifact to download.private java.util.List<org.apache.maven.artifact.repository.ArtifactRepository>
pomRemoteRepositories
private java.lang.String
remoteRepositories
Repositories in the format id::[layout]::url or just url, separated by comma.private java.util.Map<java.lang.String,org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout>
repositoryLayouts
Map that contains the layouts.private org.apache.maven.repository.RepositorySystem
repositorySystem
The repository system.private org.apache.maven.execution.MavenSession
session
private boolean
skip
Skip plugin execution completely.private boolean
transitive
Download transitively, retrieving the specified artifact and all of its dependencies.private java.lang.String
version
The version of the artifact to download.
-
Constructor Summary
Constructors Constructor Description GetMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
private org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout
getLayout(java.lang.String id)
protected boolean
isSkip()
(package private) org.apache.maven.artifact.repository.ArtifactRepository
parseRepository(java.lang.String repo, org.apache.maven.artifact.repository.ArtifactRepositoryPolicy policy)
void
setArtifactId(java.lang.String artifactId)
void
setClassifier(java.lang.String classifier)
void
setGroupId(java.lang.String groupId)
void
setPackaging(java.lang.String type)
void
setVersion(java.lang.String version)
private org.apache.maven.shared.transfer.artifact.ArtifactCoordinate
toArtifactCoordinate(org.apache.maven.shared.transfer.dependencies.DependableCoordinate dependableCoordinate)
-
-
-
Field Detail
-
ALT_REPO_SYNTAX_PATTERN
private static final java.util.regex.Pattern ALT_REPO_SYNTAX_PATTERN
-
session
@Parameter(defaultValue="${session}", required=true, readonly=true) private org.apache.maven.execution.MavenSession session
-
artifactResolver
@Component private org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver artifactResolver
-
dependencyResolver
@Component private org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver dependencyResolver
-
artifactHandlerManager
@Component private org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager
-
repositoryLayouts
@Component(role=org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout.class) private java.util.Map<java.lang.String,org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout> repositoryLayouts
Map that contains the layouts.
-
repositorySystem
@Component private org.apache.maven.repository.RepositorySystem repositorySystem
The repository system.
-
coordinate
private org.apache.maven.shared.transfer.dependencies.DefaultDependableCoordinate coordinate
-
groupId
@Parameter(property="groupId") private java.lang.String groupId
The groupId of the artifact to download. Ignored ifartifact
is used.
-
artifactId
@Parameter(property="artifactId") private java.lang.String artifactId
The artifactId of the artifact to download. Ignored ifartifact
is used.
-
version
@Parameter(property="version") private java.lang.String version
The version of the artifact to download. Ignored ifartifact
is used.
-
classifier
@Parameter(property="classifier") private java.lang.String classifier
The classifier of the artifact to download. Ignored ifartifact
is used.- Since:
- 2.3
-
packaging
@Parameter(property="packaging", defaultValue="jar") private java.lang.String packaging
The packaging of the artifact to download. Ignored ifartifact
is used.
-
remoteRepositories
@Parameter(property="remoteRepositories") private java.lang.String remoteRepositories
Repositories in the format id::[layout]::url or just url, separated by comma. ie. central::default::https://repo.maven.apache.org/maven2,myrepo::::https://repo.acme.com,https://repo.acme2.com
-
artifact
@Parameter(property="artifact") private java.lang.String artifact
A string of the form groupId:artifactId:version[:packaging[:classifier]].
-
pomRemoteRepositories
@Parameter(defaultValue="${project.remoteArtifactRepositories}", readonly=true, required=true) private java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> pomRemoteRepositories
-
transitive
@Parameter(property="transitive", defaultValue="true") private boolean transitive
Download transitively, retrieving the specified artifact and all of its dependencies.
-
skip
@Parameter(property="mdep.skip", defaultValue="false") private boolean skip
Skip plugin execution completely.- Since:
- 2.7
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
toArtifactCoordinate
private org.apache.maven.shared.transfer.artifact.ArtifactCoordinate toArtifactCoordinate(org.apache.maven.shared.transfer.dependencies.DependableCoordinate dependableCoordinate)
-
parseRepository
org.apache.maven.artifact.repository.ArtifactRepository parseRepository(java.lang.String repo, org.apache.maven.artifact.repository.ArtifactRepositoryPolicy policy) throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
getLayout
private org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout getLayout(java.lang.String id) throws org.apache.maven.plugin.MojoFailureException
- Throws:
org.apache.maven.plugin.MojoFailureException
-
isSkip
protected boolean isSkip()
- Returns:
skip
-
setGroupId
public void setGroupId(java.lang.String groupId)
- Parameters:
groupId
- The groupId.
-
setArtifactId
public void setArtifactId(java.lang.String artifactId)
- Parameters:
artifactId
- The artifactId.
-
setVersion
public void setVersion(java.lang.String version)
- Parameters:
version
- The version.
-
setClassifier
public void setClassifier(java.lang.String classifier)
- Parameters:
classifier
- The classifier to be used.
-
setPackaging
public void setPackaging(java.lang.String type)
- Parameters:
type
- packaging.
-
-