Class AntRunMojo

java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.antrun.AntRunMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="run", threadSafe=true, requiresDependencyResolution=TEST) public class AntRunMojo extends org.apache.maven.plugin.AbstractMojo

Maven AntRun Mojo.

This plugin provides the capability of calling Ant tasks from a POM by running the nested Ant tasks inside the <target/> parameter. It is encouraged to move the actual tasks to a separate build.xml file and call that file with an <ant/> task.

Author:
Kenney Westerhof, Vincent Siveton
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The path to The XML file containing the definition of the Maven tasks.
    static final String
    The default target name.
    static final String
    The refid used to store the Maven project object in the Ant build.
    static final String
    The refid used to store an object of type MavenAntRunProject containing the Maven project object in the Ant build.
    static final String
    The refid used to store the Maven project object in the Ant build.
    protected org.apache.maven.artifact.repository.ArtifactRepository
    The local Maven repository
    static final String
    The prefix of all refid used by the plugin.
    static final String
    The URI which defines the built in Ant tasks
    static final String
    The default encoding to use for the generated Ant build.

    Fields inherited from interface org.apache.maven.plugin.Mojo

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
    AntRunMojo(org.apache.maven.project.MavenProjectHelper projectHelper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    copyProperties(org.apache.maven.project.MavenProject mavenProject, org.apache.tools.ant.Project antProject)
    Copy properties from the Maven project to the Ant project.
    void
    copyProperties(org.apache.tools.ant.Project antProject, org.apache.maven.project.MavenProject mavenProject)
    Copy properties from the Ant project to the Maven project.
    void
     
    void
    initMavenTasks(org.apache.tools.ant.Project antProject)
     

    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 Details

    • MAVEN_REFID_PREFIX

      public static final String MAVEN_REFID_PREFIX
      The prefix of all refid used by the plugin.
      See Also:
    • DEFAULT_MAVEN_PROJECT_REFID

      public static final String DEFAULT_MAVEN_PROJECT_REFID
      The refid used to store the Maven project object in the Ant build. If this reference is retrieved in a custom task, note that this will be a clone of the Maven project, and not the project itself, when the task is called through an ant task.
      See Also:
    • DEFAULT_MAVEN_PROJECT_REF_REFID

      public static final String DEFAULT_MAVEN_PROJECT_REF_REFID
      The refid used to store an object of type MavenAntRunProject containing the Maven project object in the Ant build. This is useful when a custom task needs to change the Maven project, because, unlike DEFAULT_MAVEN_PROJECT_REFID, this makes sure to reference the same instance of the Maven project in all cases.
      See Also:
    • DEFAULT_MAVEN_PROJECT_HELPER_REFID

      public static final String DEFAULT_MAVEN_PROJECT_HELPER_REFID
      The refid used to store the Maven project object in the Ant build.
      See Also:
    • DEFAULT_ANT_TARGET_NAME

      public static final String DEFAULT_ANT_TARGET_NAME
      The default target name.
      See Also:
    • UTF_8

      public static final String UTF_8
      The default encoding to use for the generated Ant build.
      See Also:
    • ANTLIB

      public static final String ANTLIB
      The path to The XML file containing the definition of the Maven tasks.
      See Also:
    • TASK_URI

      public static final String TASK_URI
      The URI which defines the built in Ant tasks
      See Also:
    • localRepository

      @Parameter(property="localRepository", readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
      The local Maven repository
  • Constructor Details

    • AntRunMojo

      @Inject public AntRunMojo(org.apache.maven.project.MavenProjectHelper projectHelper)
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • copyProperties

      public void copyProperties(org.apache.maven.project.MavenProject mavenProject, org.apache.tools.ant.Project antProject)
      Copy properties from the Maven project to the Ant project.
      Parameters:
      mavenProject - MavenProject
      antProject - Project
    • copyProperties

      public void copyProperties(org.apache.tools.ant.Project antProject, org.apache.maven.project.MavenProject mavenProject)
      Copy properties from the Ant project to the Maven project.
      Parameters:
      antProject - not null
      mavenProject - not null
      Since:
      1.7
    • initMavenTasks

      public void initMavenTasks(org.apache.tools.ant.Project antProject)
      Parameters:
      antProject - Project