Package org.apache.maven.plugins.help
Class AbstractEffectiveMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.help.AbstractHelpMojo
-
- org.apache.maven.plugins.help.AbstractEffectiveMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
EffectivePomMojo
,EffectiveSettingsMojo
public abstract class AbstractEffectiveMojo extends AbstractHelpMojo
Base class with common utilities to write effective Pom/settings.- Since:
- 2.1
- Version:
- $Id: AbstractEffectiveMojo.java 1446786 2013-02-15 21:54:28Z rfscholte $
- Author:
- Vincent Siveton
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractEffectiveMojo.SortedProperties
Properties which provides a sorted keySet().
-
Field Summary
-
Fields inherited from class org.apache.maven.plugins.help.AbstractHelpMojo
LINE_LENGTH, output
-
-
Constructor Summary
Constructors Constructor Description AbstractEffectiveMojo()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static String
addMavenNamespace(String effectiveXml, boolean isPom)
Add a Pom/Settings namespaces to the effective XML content.protected static void
writeComment(org.codehaus.plexus.util.xml.XMLWriter writer, String comment)
Write comments in a normalize way.protected static void
writeHeader(org.codehaus.plexus.util.xml.XMLWriter writer)
Write comments in the Effective POM/settings header.protected static void
writeXmlFile(File output, String content, String encoding)
Utility method to write an XML content in a given file.-
Methods inherited from class org.apache.maven.plugins.help.AbstractHelpMojo
writeFile, writeFile
-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Method Detail
-
writeXmlFile
protected static void writeXmlFile(File output, String content, String encoding) throws IOException
Utility method to write an XML content in a given file.- Parameters:
output
- is the wanted output file.content
- contains the XML content to be written to the file.encoding
- is the wanted encoding to use when writing file.- Throws:
IOException
- if any- See Also:
if encoding is null.
-
writeHeader
protected static void writeHeader(org.codehaus.plexus.util.xml.XMLWriter writer)
Write comments in the Effective POM/settings header.- Parameters:
writer
- not null
-
writeComment
protected static void writeComment(org.codehaus.plexus.util.xml.XMLWriter writer, String comment)
Write comments in a normalize way.- Parameters:
writer
- not nullcomment
- not null
-
addMavenNamespace
protected static String addMavenNamespace(String effectiveXml, boolean isPom)
Add a Pom/Settings namespaces to the effective XML content.- Parameters:
effectiveXml
- not null the effective POM or SettingsisPom
- iftrue
add the Pom xsd url, otherwise add the settings xsd url.- Returns:
- the content of the root element, i.e. <project/> or <settings/> with the Maven namespace or
the original
effective
if an error occurred. - See Also:
POM_XSD_URL
,SETTINGS_XSD_URL
-
-