Package org.apache.maven.plugins.invoker
Class InstallMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.invoker.InstallMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="install", defaultPhase=PRE_INTEGRATION_TEST, requiresDependencyResolution=TEST, threadSafe=true) public class InstallMojo extends org.apache.maven.plugin.AbstractMojoInstalls the project artifacts of the main build into the local repository as a preparation to run the sub projects. More precisely, all artifacts of the project itself, all its locally reachable parent POMs and all its dependencies from the reactor will be installed to the local repository.- Since:
- 1.2
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]extraArtifactsExtra dependencies that need to be installed on the local repository.private java.io.FilelocalRepositoryPathThe path to the local repository into which the project artifacts should be installed for the integration tests.private org.apache.maven.project.MavenProjectprojectprivate org.eclipse.aether.RepositorySystemrepositorySystemprivate java.lang.StringscopeScope to resolve project artifacts.private org.apache.maven.execution.MavenSessionsessionprivate booleanskipInstallationA flag used to disable the installation procedure.
-
Constructor Summary
Constructors Constructor Description InstallMojo(org.eclipse.aether.RepositorySystem repositorySystem, org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.eclipse.aether.RepositorySystemSessioncreateSystemSessionForLocalRepo()Create a newRepositorySystemSessionconnected with local repo.voidexecute()Performs this mojo's tasks.private booleanhasTheSamePathAsTarget(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession systemSession)private voidinstallArtifacts(java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts)Install list of artifacts into local repository.private org.eclipse.aether.artifact.ArtifactresolveArtifact(org.eclipse.aether.artifact.Artifact artifact, java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories)private voidresolveExtraArtifacts(java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts)Resolve extra artifacts.private voidresolvePomsForArtifacts(java.util.List<org.eclipse.aether.artifact.Artifact> artifacts, java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts, java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories)private voidresolvePomWithParents(org.eclipse.aether.artifact.Artifact artifact, java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts, java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories)private voidresolveProjectArtifacts(java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts)private voidresolveProjectDependencies(java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts)private voidresolveProjectPoms(org.apache.maven.project.MavenProject project, java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts)
-
-
-
Field Detail
-
repositorySystem
private final org.eclipse.aether.RepositorySystem repositorySystem
-
session
private final org.apache.maven.execution.MavenSession session
-
project
private final org.apache.maven.project.MavenProject project
-
localRepositoryPath
@Parameter(property="invoker.localRepositoryPath", defaultValue="${session.localRepository.basedir}", required=true) private java.io.File localRepositoryPathThe path to the local repository into which the project artifacts should be installed for the integration tests. If not set, the regular local repository will be used. To prevent soiling of your regular local repository with possibly broken artifacts, it is strongly recommended to use an isolated repository for the integration tests (e.g.${project.build.directory}/it-repo).
-
skipInstallation
@Parameter(property="invoker.skip", defaultValue="false") private boolean skipInstallationA flag used to disable the installation procedure. This is primarily intended for usage from the command line to occasionally adjust the build.- Since:
- 1.4
-
extraArtifacts
@Parameter private java.lang.String[] extraArtifacts
Extra dependencies that need to be installed on the local repository.Format:
groupId:artifactId:version:type:classifier
Examples:
org.apache.maven.plugins:maven-clean-plugin:2.4:maven-plugin org.apache.maven.plugins:maven-clean-plugin:2.4:jar:javadoc
If the type is 'maven-plugin' the plugin will try to resolve the artifact using plugin remote repositories, instead of using artifact remote repositories.
NOTICE all dependencies will be resolved with transitive dependencies in
runtimescope.- Since:
- 1.6
-
scope
@Parameter(property="invoker.install.scope", defaultValue="runtime") private java.lang.String scopeScope to resolve project artifacts.- Since:
- 3.5.0
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionExceptionPerforms this mojo's tasks.- Throws:
org.apache.maven.plugin.MojoExecutionException- If the artifacts could not be installed.
-
resolveProjectArtifacts
private void resolveProjectArtifacts(java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts)
-
resolveProjectPoms
private void resolveProjectPoms(org.apache.maven.project.MavenProject project, java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts) throws org.eclipse.aether.resolution.ArtifactResolutionException- Throws:
org.eclipse.aether.resolution.ArtifactResolutionException
-
resolveProjectDependencies
private void resolveProjectDependencies(java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts) throws org.eclipse.aether.resolution.ArtifactResolutionException, org.apache.maven.plugin.MojoExecutionException, org.eclipse.aether.resolution.DependencyResolutionException- Throws:
org.eclipse.aether.resolution.ArtifactResolutionExceptionorg.apache.maven.plugin.MojoExecutionExceptionorg.eclipse.aether.resolution.DependencyResolutionException
-
resolveExtraArtifacts
private void resolveExtraArtifacts(java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts) throws org.apache.maven.plugin.MojoExecutionException, org.eclipse.aether.resolution.DependencyResolutionException, org.eclipse.aether.resolution.ArtifactResolutionExceptionResolve extra artifacts.- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.eclipse.aether.resolution.DependencyResolutionExceptionorg.eclipse.aether.resolution.ArtifactResolutionException
-
resolvePomsForArtifacts
private void resolvePomsForArtifacts(java.util.List<org.eclipse.aether.artifact.Artifact> artifacts, java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts, java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) throws org.eclipse.aether.resolution.ArtifactResolutionException, org.apache.maven.plugin.MojoExecutionException- Throws:
org.eclipse.aether.resolution.ArtifactResolutionExceptionorg.apache.maven.plugin.MojoExecutionException
-
resolvePomWithParents
private void resolvePomWithParents(org.eclipse.aether.artifact.Artifact artifact, java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts, java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) throws org.apache.maven.plugin.MojoExecutionException, org.eclipse.aether.resolution.ArtifactResolutionException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.eclipse.aether.resolution.ArtifactResolutionException
-
resolveArtifact
private org.eclipse.aether.artifact.Artifact resolveArtifact(org.eclipse.aether.artifact.Artifact artifact, java.util.List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) throws org.eclipse.aether.resolution.ArtifactResolutionException- Throws:
org.eclipse.aether.resolution.ArtifactResolutionException
-
installArtifacts
private void installArtifacts(java.util.Map<java.lang.String,org.eclipse.aether.artifact.Artifact> resolvedArtifacts) throws org.eclipse.aether.installation.InstallationExceptionInstall list of artifacts into local repository.- Throws:
org.eclipse.aether.installation.InstallationException
-
hasTheSamePathAsTarget
private boolean hasTheSamePathAsTarget(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession systemSession)
-
createSystemSessionForLocalRepo
private org.eclipse.aether.RepositorySystemSession createSystemSessionForLocalRepo()
Create a newRepositorySystemSessionconnected with local repo.
-
-