Class 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
    • Constructor Detail

      • AbstractEffectiveMojo

        public AbstractEffectiveMojo()
    • 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 null
        comment - 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 Settings
        isPom - if true 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