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 FileThe path to the local repository into which the project artifacts should be installed for the integration tests.private org.apache.maven.project.MavenProjectprivate org.eclipse.aether.RepositorySystemprivate StringScope to resolve project artifacts.private org.apache.maven.execution.MavenSessionprivate booleanA 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.RepositorySystemSessionCreate 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(Map<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, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) private voidresolveExtraArtifacts(Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) Resolve extra artifacts.private voidresolvePomsForArtifacts(List<org.eclipse.aether.artifact.Artifact> artifacts, Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) private voidresolvePomWithParents(org.eclipse.aether.artifact.Artifact artifact, Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts, List<org.eclipse.aether.repository.RemoteRepository> remoteRepositories) private voidresolveProjectArtifacts(Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) private voidresolveProjectDependencies(Map<String, org.eclipse.aether.artifact.Artifact> resolvedArtifacts) private voidresolveProjectPoms(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
runtimescope.- 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
-
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.ArtifactResolutionExceptionorg.apache.maven.plugin.MojoExecutionExceptionorg.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.ArtifactResolutionException Resolve extra artifacts.- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.eclipse.aether.resolution.DependencyResolutionExceptionorg.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.ArtifactResolutionExceptionorg.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.MojoExecutionExceptionorg.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
-
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.
-