Class AntBuildWriter
java.lang.Object
org.apache.maven.plugin.ant.AntBuildWriter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ArtifactResolverWrapperprotected static final StringThe default build file name (build.xml)protected static final intThe default line indenterprotected static final StringThe default generated build file nameprotected static final StringThe default build properties file nameprivate final Propertiesprivate final Fileprivate final booleanprivate final org.apache.maven.project.MavenProjectprivate final org.apache.maven.settings.Settings -
Constructor Summary
ConstructorsConstructorDescriptionAntBuildWriter(org.apache.maven.project.MavenProject project, ArtifactResolverWrapper artifactResolverWrapper, org.apache.maven.settings.Settings settings, boolean overwrite, Properties executionProperties) -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddProperty(Properties properties, String name, String value) Put a property in properties defined by a name and a valueprivate static StringgetCommaSeparatedList(Map[] includes, String key) private StringCheck if the local repository is in the default location:${user.home}/.m2/repository.(package private) static StringgetProjectRepoDirectory(String repoUrl, String projectDir) Gets the relative path to a repository that is rooted in the project.private static ListgetSelectorList(Map[] options) Flattens the specified file selector options into a simple string list.private ListGets the exclude patterns for the unit tests.private ListGets the include patterns for the unit tests.private StringgetUninterpolatedSystemPath(org.apache.maven.artifact.Artifact artifact) private voidwriteBuildPathDefinition(org.codehaus.plexus.util.xml.XMLWriter writer) Write path definition in the writer only for a non-POM project.private voidwriteBuildPathDefinition(org.codehaus.plexus.util.xml.XMLWriter writer, String id, List artifacts) protected voidGeneratemaven-build.propertiesonly for a non-POM projectprivate voidGenerate an genericbuild.xmlif not already existprotected voidGenerate Ant build XML filesprivate voidwriteCleanTarget(org.codehaus.plexus.util.xml.XMLWriter writer) Write clean target in the writer depending the packaging of the project.private voidwriteCompileTarget(org.codehaus.plexus.util.xml.XMLWriter writer, List compileSourceRoots) Write compile target in the writer depending the packaging of the project.private voidwriteCompileTasks(org.codehaus.plexus.util.xml.XMLWriter writer, String outputDirectory, List compileSourceRoots, List resources, String additionalClassesDirectory, boolean isTest) private voidwriteCompileTestsTarget(org.codehaus.plexus.util.xml.XMLWriter writer, List testCompileSourceRoots) Write compile-test target in the writer depending the packaging of the project.private voidGenerate anmaven-build.xmlprivate voidwriteGetDepsTarget(org.codehaus.plexus.util.xml.XMLWriter writer) Write get-deps target in the writer only for a non-POM projectprivate voidwriteJavadocTarget(org.codehaus.plexus.util.xml.XMLWriter writer) Write javadoc target in the writer depending the packaging of the project.private voidwritePackageTarget(org.codehaus.plexus.util.xml.XMLWriter writer) Write package target in the writer depending the packaging of the project.private voidwritePomParts(org.codehaus.plexus.util.xml.XMLWriter writer) private voidwriteProperties(org.codehaus.plexus.util.xml.XMLWriter writer) Write properties in the writer only for a non-POM project.private voidwriteTestFilesets(org.codehaus.plexus.util.xml.XMLWriter writer, List testCompileSourceRoots, List includes, List excludes) Write the<fileset>elements for the test compile source roots.private voidwriteTestTargets(org.codehaus.plexus.util.xml.XMLWriter writer, List testCompileSourceRoots) Write test target in the writer depending the packaging of the project.
-
Field Details
-
DEFAULT_INDENTATION_SIZE
protected static final int DEFAULT_INDENTATION_SIZEThe default line indenter- See Also:
-
DEFAULT_BUILD_FILENAME
The default build file name (build.xml)- See Also:
-
DEFAULT_MAVEN_BUILD_FILENAME
The default generated build file name- See Also:
-
DEFAULT_MAVEN_PROPERTIES_FILENAME
The default build properties file name- See Also:
-
project
private final org.apache.maven.project.MavenProject project -
artifactResolverWrapper
-
localRepository
-
settings
private final org.apache.maven.settings.Settings settings -
overwrite
private final boolean overwrite -
executionProperties
-
-
Constructor Details
-
AntBuildWriter
public AntBuildWriter(org.apache.maven.project.MavenProject project, ArtifactResolverWrapper artifactResolverWrapper, org.apache.maven.settings.Settings settings, boolean overwrite, Properties executionProperties) - Parameters:
project-MavenProjectartifactResolverWrapper-ArtifactResolverWrappersettings-Settingsoverwrite- true/false to overwrite or not.executionProperties-Properties
-
-
Method Details
-
writeBuildXmls
Generate Ant build XML files- Throws:
IOException- In case of an error.
-
writeBuildProperties
Generatemaven-build.propertiesonly for a non-POM project- Throws:
IOException- In case of an failureIOException- See Also:
-
writeGeneratedBuildXml
Generate anmaven-build.xml- Throws:
IOException- See Also:
-
writeBuildXml
Generate an genericbuild.xmlif not already exist- Throws:
IOException- See Also:
-
writeProperties
private void writeProperties(org.codehaus.plexus.util.xml.XMLWriter writer) Write properties in the writer only for a non-POM project.- Parameters:
writer-
-
getLocalRepositoryPath
Check if the local repository is in the default location:${user.home}/.m2/repository. If that is the case then return the path with the system property "user.home" in it. If not then just return the absolute path to the local repository. -
writeBuildPathDefinition
private void writeBuildPathDefinition(org.codehaus.plexus.util.xml.XMLWriter writer) Write path definition in the writer only for a non-POM project.- Parameters:
writer-
-
writeBuildPathDefinition
-
getUninterpolatedSystemPath
-
writeCleanTarget
private void writeCleanTarget(org.codehaus.plexus.util.xml.XMLWriter writer) Write clean target in the writer depending the packaging of the project.- Parameters:
writer- the writer
-
writeCompileTarget
private void writeCompileTarget(org.codehaus.plexus.util.xml.XMLWriter writer, List compileSourceRoots) throws IOException Write compile target in the writer depending the packaging of the project.- Parameters:
writer-compileSourceRoots-- Throws:
IOException- if any
-
writeCompileTestsTarget
private void writeCompileTestsTarget(org.codehaus.plexus.util.xml.XMLWriter writer, List testCompileSourceRoots) throws IOException Write compile-test target in the writer depending the packaging of the project.- Parameters:
writer-testCompileSourceRoots-- Throws:
IOException- if any
-
writeTestTargets
private void writeTestTargets(org.codehaus.plexus.util.xml.XMLWriter writer, List testCompileSourceRoots) throws IOException Write test target in the writer depending the packaging of the project.- Parameters:
writer-testCompileSourceRoots-- Throws:
IOException
-
writePomParts
private void writePomParts(org.codehaus.plexus.util.xml.XMLWriter writer) - Parameters:
writer-XMLWriter
-
getTestIncludes
Gets the include patterns for the unit tests.- Returns:
- A list of strings with include patterns, might be empty but never
null. - Throws:
IOException
-
getTestExcludes
Gets the exclude patterns for the unit tests.- Returns:
- A list of strings with exclude patterns, might be empty but never
null. - Throws:
IOException
-
writeTestFilesets
-
writeJavadocTarget
Write javadoc target in the writer depending the packaging of the project.- Parameters:
writer-- Throws:
IOException- if any
-
writePackageTarget
Write package target in the writer depending the packaging of the project.- Parameters:
writer-- Throws:
IOException- if any
-
writeCompileTasks
private void writeCompileTasks(org.codehaus.plexus.util.xml.XMLWriter writer, String outputDirectory, List compileSourceRoots, List resources, String additionalClassesDirectory, boolean isTest) throws IOException - Throws:
IOException
-
writeGetDepsTarget
private void writeGetDepsTarget(org.codehaus.plexus.util.xml.XMLWriter writer) Write get-deps target in the writer only for a non-POM project- Parameters:
writer-
-
getProjectRepoDirectory
Gets the relative path to a repository that is rooted in the project. The returned path (if any) will always use the forward slash ('/') as the directory separator. For example, the path "target/it-repo" will be returned for a repository constructed from the URL "file://${basedir}/target/it-repo".- Parameters:
repoUrl- The URL to the repository, must not benull.projectDir- The absolute path to the base directory of the project, must not benull- Returns:
- The path to the repository (relative to the project base directory) or
nullif the repository is not rooted in the project.
-
addProperty
Put a property in properties defined by a name and a value- Parameters:
properties- not nullname-value- not null
-
getCommaSeparatedList
-
getSelectorList
Flattens the specified file selector options into a simple string list. For instance, the input[ {include="*Test.java"}, {include="*TestCase.java"} ]is converted to[ "*Test.java", "*TestCase.java" ]
- Parameters:
options- The file selector options to flatten, may benull.- Returns:
- The string list, might be empty but never
null.
-