@Mojo(name="run",
threadSafe=true,
requiresDependencyResolution=TEST)
public class AntRunMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ANTLIB
The path to The XML file containing the definition of the Maven tasks.
|
private java.lang.String |
antTargetName
The name used for the Ant target
|
private java.lang.String |
customTaskPrefix
The xml tag prefix to use for the built in Ant tasks.
|
static java.lang.String |
DEFAULT_ANT_TARGET_NAME
The default target name.
|
static java.lang.String |
DEFAULT_MAVEN_PROJECT_HELPER_REFID
The refid used to store the Maven project object in the Ant build.
|
static java.lang.String |
DEFAULT_MAVEN_PROJECT_REFID
The refid used to store the Maven project object in the Ant build.
|
static java.lang.String |
DEPENDENCY_PREFIX
Deprecated.
This should only be used for generating the old property format.
|
private boolean |
exportAntProperties
Specifies whether the Ant properties should be propagated to the Maven properties.
|
private boolean |
failOnError
Specifies whether a failure in the Ant build leads to a failure of the Maven build.
|
protected org.apache.maven.artifact.repository.ArtifactRepository |
localRepository
The local Maven repository
|
private java.util.List<org.apache.maven.artifact.Artifact> |
pluginArtifacts
The plugin dependencies.
|
private org.apache.maven.project.MavenProject |
project
The Maven project object
|
private org.apache.maven.project.MavenProjectHelper |
projectHelper
The Maven project helper object
|
private java.lang.String |
propertyPrefix
String to prepend to project and dependency property names.
|
private boolean |
skip
Specifies whether the Antrun execution should be skipped.
|
private java.io.File |
sourceRoot
Deprecated.
Use the build-helper-maven-plugin to bind source directories
|
private org.codehaus.plexus.configuration.PlexusConfiguration |
target
The XML for the Ant target.
|
static java.lang.String |
TASK_URI
The URI which defines the built in Ant tasks
|
private org.codehaus.plexus.configuration.PlexusConfiguration |
tasks
Deprecated.
Use target instead
|
private java.io.File |
testSourceRoot
Deprecated.
Use the build-helper-maven-plugin to bind test source directories
|
static java.lang.String |
UTF_8
The default encoding to use for the generated Ant build.
|
private java.lang.String |
versionsPropertyName
The name of a property containing the list of all dependency versions.
|
Constructor and Description |
---|
AntRunMojo() |
Modifier and Type | Method and Description |
---|---|
java.lang.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() |
private java.lang.String |
findFragment(org.apache.tools.ant.BuildException buildException) |
static java.lang.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 project
|
org.apache.tools.ant.types.Path |
getPathFromArtifacts(java.util.Collection<org.apache.maven.artifact.Artifact> artifacts,
org.apache.tools.ant.Project antProject) |
void |
initMavenTasks(org.apache.tools.ant.Project antProject) |
void |
stringReplace(java.lang.StringBuilder text,
java.lang.String match,
java.lang.String with)
Replace text in a StringBuilder.
|
private java.io.File |
writeTargetToProjectFile()
Write the Ant target and surrounding tags to a temporary file
|
public static final java.lang.String DEFAULT_MAVEN_PROJECT_REFID
public static final java.lang.String DEFAULT_MAVEN_PROJECT_HELPER_REFID
public static final java.lang.String DEFAULT_ANT_TARGET_NAME
public static final java.lang.String UTF_8
private java.lang.String antTargetName
public static final java.lang.String ANTLIB
public static final java.lang.String TASK_URI
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
@Component private org.apache.maven.project.MavenProjectHelper projectHelper
@Parameter(property="plugin.artifacts", required=true, readonly=true) private java.util.List<org.apache.maven.artifact.Artifact> pluginArtifacts
@Parameter(property="localRepository", readonly=true) protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
@Parameter(defaultValue="") private java.lang.String propertyPrefix
@Parameter(defaultValue="") private java.lang.String customTaskPrefix
@Parameter(defaultValue="maven.project.dependencies.versions") private java.lang.String versionsPropertyName
@Parameter private org.codehaus.plexus.configuration.PlexusConfiguration tasks
@Parameter private org.codehaus.plexus.configuration.PlexusConfiguration target
@Parameter(property="sourceRoot") private java.io.File sourceRoot
@Parameter(property="testSourceRoot") private java.io.File testSourceRoot
@Parameter(property="maven.antrun.skip", defaultValue="false") private boolean skip
@Parameter(defaultValue="false") private boolean exportAntProperties
@Parameter(defaultValue="true") private boolean failOnError
false
, the Maven build will proceed even if the Ant build fails. If it is
true
, then the Maven build fails if the Ant build fails.public static final java.lang.String DEPENDENCY_PREFIX
public void execute() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
public org.apache.tools.ant.types.Path getPathFromArtifacts(java.util.Collection<org.apache.maven.artifact.Artifact> artifacts, org.apache.tools.ant.Project antProject) throws org.apache.maven.artifact.DependencyResolutionRequiredException
artifacts
- Artifact
collection.antProject
- Project
Path
org.apache.maven.artifact.DependencyResolutionRequiredException
- In case of a failure.public void copyProperties(org.apache.maven.project.MavenProject mavenProject, org.apache.tools.ant.Project antProject)
mavenProject
- MavenProject
antProject
- Project
public void copyProperties(org.apache.tools.ant.Project antProject, org.apache.maven.project.MavenProject mavenProject)
antProject
- not nullmavenProject
- not nullpublic static java.lang.String getDependencyArtifactPropertyName(org.apache.maven.artifact.Artifact artifact)
artifact
- Artifact
public org.apache.maven.project.MavenProject getMavenProject()
public void initMavenTasks(org.apache.tools.ant.Project antProject)
antProject
- Project
private java.io.File writeTargetToProjectFile() throws java.io.IOException, org.codehaus.plexus.configuration.PlexusConfigurationException
org.codehaus.plexus.configuration.PlexusConfigurationException
java.io.IOException
public void stringReplace(java.lang.StringBuilder text, java.lang.String match, java.lang.String with)
text
- The string buffer containing the textmatch
- The string to match and removewith
- The string to insertpublic java.lang.String checkTargetName(org.codehaus.plexus.configuration.PlexusConfiguration antTargetConfig) throws org.codehaus.plexus.configuration.PlexusConfigurationException
antTargetConfig
- PlexusConfiguration
org.codehaus.plexus.configuration.PlexusConfigurationException
- in case of not existing attribute.private java.lang.String findFragment(org.apache.tools.ant.BuildException buildException)
buildException
- not null