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.AbstractMojo
Installs 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
FieldsModifier and TypeFieldDescriptionprivate String[]
Extra dependencies that need to be installed on the local repository.private File
The path to the local repository into which the project artifacts should be installed for the integration tests.private org.apache.maven.project.MavenProject
private org.eclipse.aether.RepositorySystem
private String
Scope to resolve project artifacts.private org.apache.maven.execution.MavenSession
private boolean
A flag used to disable the installation procedure.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.eclipse.aether.RepositorySystemSession
Create a newRepositorySystemSession
connected with local repo.void
execute()
Performs this mojo's tasks.private boolean
hasTheSamePathAsTarget
(org.eclipse.aether.artifact.Artifact artifact, org.eclipse.aether.RepositorySystemSession systemSession) private void
installArtifacts
(Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) Install list of artifacts into local repository.private org.eclipse.aether.artifact.Artifact
resolveArtifact
(org.eclipse.aether.artifact.Artifact artifact, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) private void
resolveExtraArtifacts
(Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) Resolve extra artifacts.private void
resolvePomsForArtifacts
(List<org.eclipse.aether.artifact.Artifact> artifacts, Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) private void
resolvePomWithParents
(org.eclipse.aether.artifact.Artifact artifact, Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) private void
resolveProjectArtifacts
(Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) private void
resolveProjectDependencies
(Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) private void
resolveProjectPoms
(org.apache.maven.project.MavenProject project, Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
repositorySystem
@Component private org.eclipse.aether.RepositorySystem repositorySystem -
session
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session -
project
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project -
localRepositoryPath
@Parameter(property="invoker.localRepositoryPath", defaultValue="${session.localRepository.basedir}", required=true) private 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
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
runtime
scope.- Since:
- 1.6
-
scope
Scope to resolve project artifacts.- Since:
- 3.5.0
-
-
Constructor Details
-
InstallMojo
public InstallMojo()
-
-
Method Details
-
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
-
resolveProjectPoms
private void resolveProjectPoms(org.apache.maven.project.MavenProject project, Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) throws org.eclipse.aether.resolution.ArtifactResolutionException- Throws:
org.eclipse.aether.resolution.ArtifactResolutionException
-
resolveProjectDependencies
private void resolveProjectDependencies(Map<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.ArtifactResolutionException
org.apache.maven.plugin.MojoExecutionException
org.eclipse.aether.resolution.DependencyResolutionException
-
resolveExtraArtifacts
private void resolveExtraArtifacts(Map<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.MojoExecutionException
org.eclipse.aether.resolution.DependencyResolutionException
org.eclipse.aether.resolution.ArtifactResolutionException
-
resolvePomsForArtifacts
private void resolvePomsForArtifacts(List<org.eclipse.aether.artifact.Artifact> artifacts, Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) throws org.eclipse.aether.resolution.ArtifactResolutionException, org.apache.maven.plugin.MojoExecutionException- Throws:
org.eclipse.aether.resolution.ArtifactResolutionException
org.apache.maven.plugin.MojoExecutionException
-
resolvePomWithParents
private void resolvePomWithParents(org.eclipse.aether.artifact.Artifact artifact, Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) throws org.apache.maven.plugin.MojoExecutionException, org.eclipse.aether.resolution.ArtifactResolutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
org.eclipse.aether.resolution.ArtifactResolutionException
-
resolveArtifact
private org.eclipse.aether.artifact.Artifact resolveArtifact(org.eclipse.aether.artifact.Artifact artifact, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) throws org.eclipse.aether.resolution.ArtifactResolutionException - Throws:
org.eclipse.aether.resolution.ArtifactResolutionException
-
installArtifacts
private void installArtifacts(Map<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 newRepositorySystemSession
connected with local repo.
-