Class 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.AbstractMojo
    Installs 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 class  InstallMojo.State  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean allowIncompleteProjects
      Set this to true to allow incomplete project processing.
      private static java.lang.String INSTALL_PROCESSED_MARKER  
      private boolean installAtEnd
      Whether every project should be installed during its own install-phase or at the end of the multimodule build.
      private org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor  
      private org.apache.maven.project.MavenProject project  
      private java.util.List<org.apache.maven.project.MavenProject> reactorProjects  
      private org.eclipse.aether.RepositorySystem repositorySystem  
      private org.apache.maven.execution.MavenSession session  
      private boolean skip
      Set this to true to bypass artifact installation.
      • Fields inherited from interface org.apache.maven.plugin.Mojo

        ROLE
    • Constructor Summary

      Constructors 
      Constructor Description
      InstallMojo()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean allProjectsMarked​(java.util.List<org.apache.maven.project.MavenProject> allProjectsUsingPlugin)  
      void execute()  
      private java.util.List<org.apache.maven.project.MavenProject> getAllProjectsUsingPlugin()  
      private InstallMojo.State getState​(org.apache.maven.project.MavenProject project)  
      private boolean hasExecution​(org.apache.maven.model.Plugin plugin)  
      private boolean hasState​(org.apache.maven.project.MavenProject project)  
      private void installProject​(org.eclipse.aether.installation.InstallRequest request)  
      private boolean isFile​(java.io.File file)  
      private void processProject​(org.apache.maven.project.MavenProject project, org.eclipse.aether.installation.InstallRequest request)
      Processes passed in MavenProject and prepares content of InstallRequest out of it.
      private void putState​(InstallMojo.State state)  
      • Methods inherited from class org.apache.maven.plugin.AbstractMojo

        getLog, getPluginContext, setLog, setPluginContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • repositorySystem

        @Component
        private 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
      • reactorProjects

        @Parameter(defaultValue="${reactorProjects}",
                   required=true,
                   readonly=true)
        private java.util.List<org.apache.maven.project.MavenProject> reactorProjects
      • pluginDescriptor

        @Parameter(defaultValue="${plugin}",
                   required=true,
                   readonly=true)
        private org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor
      • installAtEnd

        @Parameter(defaultValue="false",
                   property="installAtEnd")
        private boolean installAtEnd
        Whether every project should be installed during its own install-phase or at the end of the multimodule build. If set to true and the build fails, none of the reactor projects is installed. (experimental)
        Since:
        2.5
      • skip

        @Parameter(property="maven.install.skip",
                   defaultValue="false")
        private boolean skip
        Set this to true to 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 allowIncompleteProjects
        Set this to true to 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
    • Constructor Detail

      • InstallMojo

        public InstallMojo()
    • Method Detail

      • getState

        private InstallMojo.State getState​(org.apache.maven.project.MavenProject project)
      • hasState

        private boolean hasState​(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> allProjectsUsingPlugin)
      • getAllProjectsUsingPlugin

        private java.util.List<org.apache.maven.project.MavenProject> getAllProjectsUsingPlugin()
      • hasExecution

        private boolean hasExecution​(org.apache.maven.model.Plugin plugin)
      • 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.MojoExecutionException
        Processes passed in MavenProject and prepares content of InstallRequest out of it.
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if project is badly set up.
      • isFile

        private boolean isFile​(java.io.File file)