Package org.apache.maven.plugin.antrun
Class AntRunMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugin.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.AbstractMojoMaven 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.java 1645339 2014-12-13 17:56:59Z khmarbaise $
- Author:
- Kenney Westerhof, Vincent Siveton
-
-
Field Summary
Fields Modifier and Type Field Description static StringANTLIBThe path to The XML file containing the definition of the Maven tasks.static StringDEFAULT_ANT_TARGET_NAMEThe default target name.static StringDEFAULT_MAVEN_PROJECT_HELPER_REFIDThe refid used to store the Maven project object in the Ant build.static StringDEFAULT_MAVEN_PROJECT_REFIDThe refid used to store the Maven project object in the Ant build.static StringDEPENDENCY_PREFIXDeprecated.This should only be used for generating the old property format.protected org.apache.maven.artifact.repository.ArtifactRepositorylocalRepositoryThe local Maven repositorystatic StringTASK_URIThe URI which defines the built in Ant tasksstatic StringUTF_8The default encoding to use for the generated Ant build.
-
Constructor Summary
Constructors Constructor Description AntRunMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description StringcheckTargetName(org.codehaus.plexus.configuration.PlexusConfiguration antTargetConfig)voidcopyProperties(org.apache.maven.project.MavenProject mavenProject, org.apache.tools.ant.Project antProject)Copy properties from the Maven project to the Ant project.voidcopyProperties(org.apache.tools.ant.Project antProject, org.apache.maven.project.MavenProject mavenProject)Copy properties from the Ant project to the Maven project.voidexecute()static StringgetDependencyArtifactPropertyName(org.apache.maven.artifact.Artifact artifact)Deprecated.The dependency conflict ID should be used as the property name.org.apache.maven.project.MavenProjectgetMavenProject()Get the current Maven projectorg.apache.tools.ant.types.PathgetPathFromArtifacts(Collection<org.apache.maven.artifact.Artifact> artifacts, org.apache.tools.ant.Project antProject)voidinitMavenTasks(org.apache.tools.ant.Project antProject)voidstringReplace(StringBuilder text, String match, String with)Replace text in a StringBuilder.
-
-
-
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
@Parameter(property="localRepository", readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepositoryThe local Maven repository
-
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
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getPathFromArtifacts
public org.apache.tools.ant.types.Path getPathFromArtifacts(Collection<org.apache.maven.artifact.Artifact> artifacts, org.apache.tools.ant.Project antProject) throws org.apache.maven.artifact.DependencyResolutionRequiredException
- Parameters:
artifacts-Artifactcollection.antProject-Project- Returns:
Path- Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException- In case of a failure.
-
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-MavenProjectantProject-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 nullmavenProject- not null- Since:
- 1.7
-
getDependencyArtifactPropertyName
public static String getDependencyArtifactPropertyName(org.apache.maven.artifact.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-Artifact- Returns:
- property name
-
getMavenProject
public org.apache.maven.project.MavenProject getMavenProject()
Get the current Maven project- Returns:
- current Maven project
-
initMavenTasks
public void initMavenTasks(org.apache.tools.ant.Project antProject)
- Parameters:
antProject-Project
-
stringReplace
public void stringReplace(StringBuilder text, String match, String with)
Replace text in a StringBuilder. If the match text is not found, the StringBuilder is returned unchanged.- Parameters:
text- The string buffer containing the textmatch- The string to match and removewith- The string to insert
-
checkTargetName
public String checkTargetName(org.codehaus.plexus.configuration.PlexusConfiguration antTargetConfig) throws org.codehaus.plexus.configuration.PlexusConfigurationException
- Parameters:
antTargetConfig-PlexusConfiguration- Returns:
- The target name.
- Throws:
org.codehaus.plexus.configuration.PlexusConfigurationException- in case of not existing attribute.
-
-