org.apache.maven.plugin.ant
Class AntBuildWriterUtil

java.lang.Object
  extended by org.apache.maven.plugin.ant.AntBuildWriterUtil

public class AntBuildWriterUtil
extends Object

Utility class for the AntBuildWriter class.

Version:
$Id: AntBuildWriterUtil.java 833678 2009-11-07 14:02:13Z bentmann $
Author:
Vincent Siveton

Constructor Summary
AntBuildWriterUtil()
           
 
Method Summary
static void addWrapAttribute(XMLWriter writer, String tag, String name, String value, int indent)
          Convenience method to wrap long element tags for a given attribute.
static String getMavenCompilerPluginBasicOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return the optionName value defined in a project for the "maven-compiler-plugin" plugin.
static Map getMavenCompilerPluginOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return the map of optionName value defined in a project for the "maven-compiler-plugin" plugin.
static Map[] getMavenCompilerPluginOptions(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return an array of map of optionName value defined in a project for the "maven-compiler-plugin" plugin.
static String getMavenEarPluginBasicOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return the optionName value defined in a project for the "maven-ear-plugin" plugin.
static String getMavenJarPluginBasicOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return the optionName value defined in a project for the "maven-jar-plugin" plugin.
static String getMavenJavadocPluginBasicOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return the optionName value defined in a project for the "maven-javadoc-plugin" plugin.
static Map getMavenJavadocPluginOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return a map of optionName value defined in a project for the "maven-javadoc-plugin" plugin.
static Map[] getMavenJavadocPluginOptions(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return an array of map of optionName value defined in a project for the "maven-javadoc-plugin" plugin.
static String getMavenSurefirePluginBasicOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return the optionName value defined in a project for the "maven-surefire-plugin" plugin.
static Map getMavenSurefirePluginOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return the map of optionName value defined in a project for the "maven-surefire-plugin" plugin.
static Map[] getMavenSurefirePluginOptions(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return an array of map of optionName value defined in a project for the "maven-surefire-plugin" plugin.
static String getMavenWarPluginBasicOption(org.apache.maven.project.MavenProject project, String optionName, String defaultValue)
          Return the optionName value defined in a project for the "maven-war-plugin" plugin.
static boolean isBundlePackaging(org.apache.maven.project.MavenProject mavenProject)
           
static boolean isEarPackaging(org.apache.maven.project.MavenProject mavenProject)
           
static boolean isEjbPackaging(org.apache.maven.project.MavenProject mavenProject)
           
static boolean isJarPackaging(org.apache.maven.project.MavenProject mavenProject)
           
static boolean isMavenPluginPackaging(org.apache.maven.project.MavenProject mavenProject)
           
static boolean isPomPackaging(org.apache.maven.project.MavenProject mavenProject)
           
static boolean isWarPackaging(org.apache.maven.project.MavenProject mavenProject)
           
static List removeEmptyCompileSourceRoots(List compileSourceRoots)
           
static void writeAntTask(XMLWriter writer, org.apache.maven.project.MavenProject project, String moduleSubPath, String tasks)
          Convenience method to write XML ant task
static void writeAntVersionHeader(XMLWriter writer)
          Write comment for the Ant supported version
static void writeEarTask(XMLWriter writer, org.apache.maven.project.MavenProject project, ArtifactResolverWrapper artifactResolverWrapper)
          Convenience method to write XML Ant ear task
static void writeHeader(XMLWriter writer)
          Write comments in the Ant build file header
static void writeIncludesExcludes(XMLWriter writer, List includes, List excludes)
          Convenience method to write <include/> and <exclude/>
static void writeJarTask(XMLWriter writer, org.apache.maven.project.MavenProject project)
          Convenience method to write XML Ant jar task
static void writeJavadocTask(XMLWriter writer, org.apache.maven.project.MavenProject project, ArtifactResolverWrapper wrapper)
          Convenience method to write XML Ant javadoc task
static void writeWarTask(XMLWriter writer, org.apache.maven.project.MavenProject project, ArtifactResolverWrapper artifactResolverWrapper)
          Convenience method to write XML Ant war task
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntBuildWriterUtil

public AntBuildWriterUtil()
Method Detail

removeEmptyCompileSourceRoots

public static List removeEmptyCompileSourceRoots(List compileSourceRoots)
Parameters:
compileSourceRoots -
Returns:
not null list

writeIncludesExcludes

public static void writeIncludesExcludes(XMLWriter writer,
                                         List includes,
                                         List excludes)
Convenience method to write <include/> and <exclude/>

Parameters:
writer - not null
includes -
excludes -

writeHeader

public static void writeHeader(XMLWriter writer)
Write comments in the Ant build file header

Parameters:
writer -

writeAntVersionHeader

public static void writeAntVersionHeader(XMLWriter writer)
Write comment for the Ant supported version

Parameters:
writer -

writeAntTask

public static void writeAntTask(XMLWriter writer,
                                org.apache.maven.project.MavenProject project,
                                String moduleSubPath,
                                String tasks)
Convenience method to write XML ant task

Parameters:
writer - not null
project - not null
moduleSubPath - not null
tasks - not null

writeJavadocTask

public static void writeJavadocTask(XMLWriter writer,
                                    org.apache.maven.project.MavenProject project,
                                    ArtifactResolverWrapper wrapper)
                             throws IOException
Convenience method to write XML Ant javadoc task

Parameters:
writer - not null
project - not null
wrapper - not null
Throws:
IOException - if any

writeJarTask

public static void writeJarTask(XMLWriter writer,
                                org.apache.maven.project.MavenProject project)
                         throws IOException
Convenience method to write XML Ant jar task

Parameters:
writer - not null
project - not null
Throws:
IOException - if any

writeEarTask

public static void writeEarTask(XMLWriter writer,
                                org.apache.maven.project.MavenProject project,
                                ArtifactResolverWrapper artifactResolverWrapper)
                         throws IOException
Convenience method to write XML Ant ear task

Parameters:
writer - not null
project - not null
artifactResolverWrapper - not null
Throws:
IOException - if any

writeWarTask

public static void writeWarTask(XMLWriter writer,
                                org.apache.maven.project.MavenProject project,
                                ArtifactResolverWrapper artifactResolverWrapper)
                         throws IOException
Convenience method to write XML Ant war task

Parameters:
writer - not null
project - not null
artifactResolverWrapper - not null
Throws:
IOException - if any

addWrapAttribute

public static void addWrapAttribute(XMLWriter writer,
                                    String tag,
                                    String name,
                                    String value,
                                    int indent)
Convenience method to wrap long element tags for a given attribute.

Parameters:
writer - not null
tag - not null
name - not null
value - not null
indent - positive value

isPomPackaging

public static boolean isPomPackaging(org.apache.maven.project.MavenProject mavenProject)
Parameters:
mavenProject - not null
Returns:
true if project packaging equals pom

isJarPackaging

public static boolean isJarPackaging(org.apache.maven.project.MavenProject mavenProject)
Parameters:
mavenProject -
Returns:
true if project packaging equals one of several packaging types including jar, maven-plugin, ejb, or bundle

isBundlePackaging

public static boolean isBundlePackaging(org.apache.maven.project.MavenProject mavenProject)
Parameters:
mavenProject -
Returns:
true if project packaging equals bundle

isEjbPackaging

public static boolean isEjbPackaging(org.apache.maven.project.MavenProject mavenProject)
Parameters:
mavenProject -
Returns:
true if project packaging equals ejb

isMavenPluginPackaging

public static boolean isMavenPluginPackaging(org.apache.maven.project.MavenProject mavenProject)
Parameters:
mavenProject -
Returns:
true if project packaging equals maven-plugin

isEarPackaging

public static boolean isEarPackaging(org.apache.maven.project.MavenProject mavenProject)
Parameters:
mavenProject -
Returns:
true if project packaging equals ear

isWarPackaging

public static boolean isWarPackaging(org.apache.maven.project.MavenProject mavenProject)
Parameters:
mavenProject - not null
Returns:
true if project packaging equals war

getMavenCompilerPluginBasicOption

public static String getMavenCompilerPluginBasicOption(org.apache.maven.project.MavenProject project,
                                                       String optionName,
                                                       String defaultValue)
                                                throws IOException
Return the optionName value defined in a project for the "maven-compiler-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the value for the option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenCompilerPluginOption

public static Map getMavenCompilerPluginOption(org.apache.maven.project.MavenProject project,
                                               String optionName,
                                               String defaultValue)
                                        throws IOException
Return the map of optionName value defined in a project for the "maven-compiler-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the map for the option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenCompilerPluginOptions

public static Map[] getMavenCompilerPluginOptions(org.apache.maven.project.MavenProject project,
                                                  String optionName,
                                                  String defaultValue)
                                           throws IOException
Return an array of map of optionName value defined in a project for the "maven-compiler-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the array of option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenSurefirePluginBasicOption

public static String getMavenSurefirePluginBasicOption(org.apache.maven.project.MavenProject project,
                                                       String optionName,
                                                       String defaultValue)
                                                throws IOException
Return the optionName value defined in a project for the "maven-surefire-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the value for the option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenSurefirePluginOption

public static Map getMavenSurefirePluginOption(org.apache.maven.project.MavenProject project,
                                               String optionName,
                                               String defaultValue)
                                        throws IOException
Return the map of optionName value defined in a project for the "maven-surefire-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the map for the option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenSurefirePluginOptions

public static Map[] getMavenSurefirePluginOptions(org.apache.maven.project.MavenProject project,
                                                  String optionName,
                                                  String defaultValue)
                                           throws IOException
Return an array of map of optionName value defined in a project for the "maven-surefire-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the array of option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenJavadocPluginBasicOption

public static String getMavenJavadocPluginBasicOption(org.apache.maven.project.MavenProject project,
                                                      String optionName,
                                                      String defaultValue)
                                               throws IOException
Return the optionName value defined in a project for the "maven-javadoc-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the value for the option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenJavadocPluginOption

public static Map getMavenJavadocPluginOption(org.apache.maven.project.MavenProject project,
                                              String optionName,
                                              String defaultValue)
                                       throws IOException
Return a map of optionName value defined in a project for the "maven-javadoc-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the map for the option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenJavadocPluginOptions

public static Map[] getMavenJavadocPluginOptions(org.apache.maven.project.MavenProject project,
                                                 String optionName,
                                                 String defaultValue)
                                          throws IOException
Return an array of map of optionName value defined in a project for the "maven-javadoc-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
an array of option name. Could be null if not found.
Throws:
IOException - if any

getMavenJarPluginBasicOption

public static String getMavenJarPluginBasicOption(org.apache.maven.project.MavenProject project,
                                                  String optionName,
                                                  String defaultValue)
                                           throws IOException
Return the optionName value defined in a project for the "maven-jar-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the value for the option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenEarPluginBasicOption

public static String getMavenEarPluginBasicOption(org.apache.maven.project.MavenProject project,
                                                  String optionName,
                                                  String defaultValue)
                                           throws IOException
Return the optionName value defined in a project for the "maven-ear-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the value for the option name or the default value. Could be null if not found.
Throws:
IOException - if any

getMavenWarPluginBasicOption

public static String getMavenWarPluginBasicOption(org.apache.maven.project.MavenProject project,
                                                  String optionName,
                                                  String defaultValue)
                                           throws IOException
Return the optionName value defined in a project for the "maven-war-plugin" plugin.

Parameters:
project - not null
optionName - the option name wanted
defaultValue - a default value
Returns:
the value for the option name or the default value. Could be null if not found.
Throws:
IOException - if any


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