java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.maven.resolver.internal.ant.tasks.AbstractDistTask
org.apache.maven.resolver.internal.ant.tasks.Install
All Implemented Interfaces:
Cloneable

public class Install extends AbstractDistTask
Ant task to install artifacts into the local Maven repository.

This task allows you to manually install artifacts into the local repository (usually ~/.m2/repository) by specifying coordinates, files, and optional POM metadata. It mimics the behavior of mvn install:install-file but is usable in Ant build scripts.

Usage Example:


 <repo:install>
   <repo:artifact file="build/libs/my-lib.jar"
             groupId="com.example"
             artifactId="my-lib"
             version="1.0.0"
             packaging="jar"/>
 </repo:install>
 
If you have used the pom task to register an existing POM, or you used the createPom task to generate and register a POM, you can instead do this:

     <repo:artifacts id='localArtifacts'>
       <repo:artifact refid='mainJar'/>
       <repo:artifact file='${srcJarFile}'
                      type='jar'
                      classifier='sources'
                      id='srcJar'/>
       <repo:artifact file='${javadocJarFile}'
                      type='jar'
                      classifier='javadocs'
                      id='javadocJar'/>
     </repo:artifacts>
     <repo:install artifactsref='localArtifacts'/>
 

Attributes:

  • failOnMissingPom — whether to fail if no POM information is provided (default: true)

Nested Elements:

  • <artifact> — specifies the artifact file and coordinates to install
  • <pom> — (optional) specifies the POM file to install along with the artifact

Behavior:

  • If a POM is not explicitly provided, a minimal one will be generated
  • Installs to the local repository used by Maven and compatible tools

This task is useful in custom build pipelines, testing, or deploying non-Maven-built artifacts to the local repo.

See Also:
  • Field Summary

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor used by Ant to create an Install task instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     

    Methods inherited from class org.apache.maven.resolver.internal.ant.tasks.AbstractDistTask

    addArtifact, addArtifacts, addPom, getArtifacts, getPom, setArtifactsRef, setPomRef, validate

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Install

      public Install()
      Default constructor used by Ant to create an Install task instance.
  • Method Details

    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException