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
Author:
Vincent Siveton
  • Constructor Details

    • AbstractEffectiveMojo

      public AbstractEffectiveMojo()
  • Method Details

    • writeXmlFile

      protected static void writeXmlFile(File output, String content) 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.
      Throws:
      IOException - if any
      See Also:
    • 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 null
      comment - not null
    • prettyFormat

      protected static String prettyFormat(String effectiveModel, String encoding, boolean omitDeclaration)
      Parameters:
      effectiveModel - not null
      encoding - not null
      omitDeclaration - whether the XML declaration should be omitted from the effective pom
      Returns:
      pretty format of the xml or the original effectiveModel if an error occurred.