Class AbstractXmlPlugin

  • All Implemented Interfaces:
    org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
    Direct Known Subclasses:
    XmlCheckPlugin, XmlFormatPlugin

    public abstract class AbstractXmlPlugin
    extends org.apache.maven.plugin.AbstractMojo
    Common infrastructure for the various plugin goals.
    • Constructor Detail

      • AbstractXmlPlugin

        public AbstractXmlPlugin()
    • Method Detail

      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • processFile

        protected abstract boolean processFile​(File input,
                                               org.dom4j.io.OutputFormat fmt)
                                        throws org.dom4j.DocumentException,
                                               IOException
        Processes a single file found in the project.
        Parameters:
        input - the file to process
        fmt - the formatting options
        Returns:
        true if the file required changes to match the formatting style
        Throws:
        org.dom4j.DocumentException - if input XML could not be parsed
        IOException - if output XML stream could not be written
      • afterAllProcessed

        protected abstract void afterAllProcessed​(boolean neededFormatting)
                                           throws org.apache.maven.plugin.MojoExecutionException
        Invoked after all files in the project have been processed.
        Parameters:
        neededFormatting - whether any processed file required changes to match the formatting style
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if the build must be failed