Class 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 Detail

      • MAVEN_REFID_PREFIX

        public static final String MAVEN_REFID_PREFIX
        The prefix of all refid used by the plugin.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • ANTLIB

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

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

      • AntRunMojo

        public AntRunMojo()
    • Method Detail

      • 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