org.apache.maven.plugin.antrun
Class AntRunMojo

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

public class AntRunMojo
extends AbstractMojo

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

Version:
$Id: AntRunMojo.html 816173 2012-05-06 22:12:29Z hboutemy $
Author:
Kenney Westerhof, Vincent Siveton
Is defined by the goal name:
run
Requires the dependencies in this specified scope:
test

Field Summary
static String ANTLIB
          The path to The XML file containing the definition of the Maven tasks.
static String DEFAULT_ANT_TARGET_NAME
          The default target name.
static String DEFAULT_MAVEN_PROJECT_HELPER_REFID
          The refid used to store the Maven project object in the Ant build.
static String DEFAULT_MAVEN_PROJECT_REFID
          The refid used to store the Maven project object in the Ant build.
static String DEPENDENCY_PREFIX
          Deprecated. This should only be used for generating the old property format.
protected  ArtifactRepository localRepository
          The local Maven repository
static String TASK_URI
          The URI which defines the built in Ant tasks
static String UTF_8
          The default encoding to use for the generated Ant build.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AntRunMojo()
           
 
Method Summary
 String checkTargetName(org.codehaus.plexus.configuration.PlexusConfiguration antTargetConfig)
           
 void copyProperties(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, MavenProject mavenProject)
          Copy properties from the ant project to the maven project.
 void execute()
           
static String getDependencyArtifactPropertyName(Artifact artifact)
          Deprecated. The dependency conflict ID should be used as the property name.
 MavenProject getMavenProject()
          Get the current Maven project
 org.apache.tools.ant.types.Path getPathFromArtifacts(Collection artifacts, org.apache.tools.ant.Project antProject)
           
 void initMavenTasks(org.apache.tools.ant.Project antProject)
           
 void stringReplace(StringBuffer text, String match, String with)
          Replace text in a StringBuffer.
 
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

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.

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

DEFAULT_ANT_TARGET_NAME

public static final String DEFAULT_ANT_TARGET_NAME
The default target name.

See Also:
Constant Field Values

UTF_8

public static final String UTF_8
The default encoding to use for the generated 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

TASK_URI

public static final String TASK_URI
The URI which defines the built in Ant tasks

See Also:
Constant Field Values

localRepository

protected ArtifactRepository localRepository
The local Maven repository

Is defined by:
expression:
${localRepository}
Is readonly.

DEPENDENCY_PREFIX

public static final String DEPENDENCY_PREFIX
Deprecated. This should only be used for generating the old property format.
Prefix for legacy property format.

See Also:
Constant Field Values
Constructor Detail

AntRunMojo

public AntRunMojo()
Method Detail

execute

public void execute()
             throws MojoExecutionException
Throws:
MojoExecutionException
See Also:
Mojo.execute()

getPathFromArtifacts

public org.apache.tools.ant.types.Path getPathFromArtifacts(Collection artifacts,
                                                            org.apache.tools.ant.Project antProject)
                                                     throws DependencyResolutionRequiredException
Parameters:
artifacts -
antProject -
Returns:
a path
Throws:
DependencyResolutionRequiredException

copyProperties

public void copyProperties(MavenProject mavenProject,
                           org.apache.tools.ant.Project antProject)
Copy properties from the maven project to the ant project.

Parameters:
mavenProject -
antProject -

copyProperties

public void copyProperties(org.apache.tools.ant.Project antProject,
                           MavenProject mavenProject)
Copy properties from the ant project to the maven project.

Parameters:
antProject - not null
mavenProject - not null
Since:
1.7

getDependencyArtifactPropertyName

public static String getDependencyArtifactPropertyName(Artifact artifact)
Deprecated. The dependency conflict ID should be used as the property name.

Returns a property name for a dependency artifact. The name is in the format maven.dependency.groupId.artifactId[.classifier].type.path

Parameters:
artifact -
Returns:
property name

getMavenProject

public MavenProject getMavenProject()
Get the current Maven project

Returns:
current Maven project

initMavenTasks

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

stringReplace

public void stringReplace(StringBuffer text,
                          String match,
                          String with)
Replace text in a StringBuffer. If the match text is not found, the StringBuffer is returned unchanged.

Parameters:
text - The string buffer containing the text
match - The string to match and remove
with - The string to insert

checkTargetName

public String checkTargetName(org.codehaus.plexus.configuration.PlexusConfiguration antTargetConfig)
                       throws org.codehaus.plexus.configuration.PlexusConfigurationException
Throws:
org.codehaus.plexus.configuration.PlexusConfigurationException


Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.