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.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.java 1645339 2014-12-13 17:56:59Z khmarbaise $
- Author:
- Kenney Westerhof, Vincent Siveton
-
-
Field Summary
Fields Modifier and Type Field Description 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 org.apache.maven.artifact.repository.ArtifactRepository
localRepository
The local Maven repositorystatic String
TASK_URI
The URI which defines the built in Ant tasksstatic String
UTF_8
The 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 String
checkTargetName(org.codehaus.plexus.configuration.PlexusConfiguration antTargetConfig)
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
execute()
static String
getDependencyArtifactPropertyName(org.apache.maven.artifact.Artifact artifact)
Deprecated.The dependency conflict ID should be used as the property name.org.apache.maven.project.MavenProject
getMavenProject()
Get the current Maven projectorg.apache.tools.ant.types.Path
getPathFromArtifacts(Collection<org.apache.maven.artifact.Artifact> artifacts, org.apache.tools.ant.Project antProject)
void
initMavenTasks(org.apache.tools.ant.Project antProject)
void
stringReplace(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 localRepository
The 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
-Artifact
collection.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
-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 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.
-
-