Class PomUtils


  • public final class PomUtils
    extends java.lang.Object
    POM helper class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean addNewModule​(java.lang.String artifactId, java.io.Reader fileReader, java.io.Writer fileWriter)
      Adds module artifactId unless the module already presents in fileReader.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • addNewModule

        public static boolean addNewModule​(java.lang.String artifactId,
                                           java.io.Reader fileReader,
                                           java.io.Writer fileWriter)
                                    throws ArchetypeTemplateProcessingException,
                                           InvalidPackaging,
                                           java.io.IOException,
                                           javax.xml.parsers.ParserConfigurationException,
                                           org.xml.sax.SAXException,
                                           javax.xml.transform.TransformerException
        Adds module artifactId unless the module already presents in fileReader.
        Parameters:
        artifactId - artifactId of module to add
        fileReader - source POM XML
        fileWriter - target XML
        Returns:
        true if modules section in POM is empty or does not exist or artifactId does not appear a module in fileReader XML.
        Throws:
        java.io.IOException - if I/O error
        InvalidPackaging - if packaging is not "pom" or not exist in POM
        ArchetypeTemplateProcessingException - if "project" does not exist or "modules" element is duplicated
        javax.xml.parsers.ParserConfigurationException - if parser error
        org.xml.sax.SAXException - if parser error
        javax.xml.transform.TransformerException - if an error writing to fileWriter