Package org.apache.maven.plugins.install
Class InstallMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.install.InstallMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="install", defaultPhase=INSTALL, threadSafe=true) public class InstallMojo extends org.apache.maven.plugin.AbstractMojoInstalls the project's main artifact, and any other artifacts attached by other plugins in the lifecycle, to the local repository.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classInstallMojo.State
-
Field Summary
Fields Modifier and Type Field Description private booleanallowIncompleteProjectsSet this totrueto allow incomplete project processing.private static java.lang.StringINSTALL_PROCESSED_MARKERprivate booleaninstallAtEndWhether every project should be installed during its own install-phase or at the end of the multimodule build.private org.apache.maven.plugin.descriptor.PluginDescriptorpluginDescriptorprivate org.apache.maven.project.MavenProjectprojectprivate static java.lang.StringPROJECTS_USING_PLUGIN_KEYprivate org.eclipse.aether.RepositorySystemrepositorySystemprivate org.apache.maven.execution.MavenSessionsessionprivate booleanskipSet this totrueto bypass artifact installation.
-
Constructor Summary
Constructors Constructor Description InstallMojo(org.eclipse.aether.RepositorySystem repositorySystem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanallProjectsMarked(java.util.List<org.apache.maven.project.MavenProject> projectsUsingPlugin)voidexecute()private java.util.List<org.apache.maven.project.MavenProject>getProjectsUsingPlugin()Returns the list of reactor projects that have this plugin configured, cached on first call.private InstallMojo.StategetState(org.apache.maven.project.MavenProject project)private booleanhasState(org.apache.maven.project.MavenProject project)private voidinstallProject(org.eclipse.aether.installation.InstallRequest request)private booleanisFile(java.io.File file)private voidprocessProject(org.apache.maven.project.MavenProject project, org.eclipse.aether.installation.InstallRequest request)Processes passed inMavenProjectand prepares content ofInstallRequestout of it.private voidputState(InstallMojo.State state)private booleanusingPlugin(org.apache.maven.project.MavenProject project)
-
-
-
Field Detail
-
repositorySystem
private final org.eclipse.aether.RepositorySystem repositorySystem
-
session
@Parameter(defaultValue="${session}", required=true, readonly=true) private org.apache.maven.execution.MavenSession session
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
-
pluginDescriptor
@Parameter(defaultValue="${plugin}", required=true, readonly=true) private org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor
-
installAtEnd
@Parameter(defaultValue="false", property="installAtEnd") private boolean installAtEndWhether every project should be installed during its own install-phase or at the end of the multimodule build. If set totrueand the build fails, none of the reactor projects is installed. (experimental)- Since:
- 2.5
-
skip
@Parameter(property="maven.install.skip", defaultValue="false") private boolean skipSet this totrueto bypass artifact installation. Use this for artifacts that do not need to be installed in the local repository.- Since:
- 2.4
-
allowIncompleteProjects
@Parameter(defaultValue="false", property="allowIncompleteProjects") private boolean allowIncompleteProjectsSet this totrueto allow incomplete project processing. By default, such projects are forbidden and Mojo will fail to process them. Incomplete project is a Maven Project that has any other packaging than "pom" and has no main artifact packaged. In the majority of cases, what user really wants here is a project with "pom" packaging and some classified artifact attached (typical example is some assembly being packaged and attached with classifier).- Since:
- 3.1.1
-
INSTALL_PROCESSED_MARKER
private static final java.lang.String INSTALL_PROCESSED_MARKER
-
PROJECTS_USING_PLUGIN_KEY
private static final java.lang.String PROJECTS_USING_PLUGIN_KEY
-
-
Method Detail
-
putState
private void putState(InstallMojo.State state)
-
getState
private InstallMojo.State getState(org.apache.maven.project.MavenProject project)
-
hasState
private boolean hasState(org.apache.maven.project.MavenProject project)
-
getProjectsUsingPlugin
private java.util.List<org.apache.maven.project.MavenProject> getProjectsUsingPlugin()
Returns the list of reactor projects that have this plugin configured, cached on first call. The list is invariant during a build and is stored in the current project's plugin context to avoid recomputing it on every module invocation (O(N) total instead of O(N²)).
-
usingPlugin
private boolean usingPlugin(org.apache.maven.project.MavenProject project)
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
allProjectsMarked
private boolean allProjectsMarked(java.util.List<org.apache.maven.project.MavenProject> projectsUsingPlugin)
-
installProject
private void installProject(org.eclipse.aether.installation.InstallRequest request) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
processProject
private void processProject(org.apache.maven.project.MavenProject project, org.eclipse.aether.installation.InstallRequest request) throws org.apache.maven.plugin.MojoExecutionExceptionProcesses passed inMavenProjectand prepares content ofInstallRequestout of it.- Throws:
org.apache.maven.plugin.MojoExecutionException- if project is badly set up.
-
isFile
private boolean isFile(java.io.File file)
-
-