Class PomUtils


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

      Constructors 
      Modifier Constructor Description
      private PomUtils()  
    • 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.
      private static org.w3c.dom.Node getModulesNode​(org.w3c.dom.Element project)  
      private static boolean hasArtifactIdInModules​(java.lang.String artifactId, org.w3c.dom.Node modules)  
      • Methods inherited from class java.lang.Object

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

      • PomUtils

        private PomUtils()
    • 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
      • getModulesNode

        private static org.w3c.dom.Node getModulesNode​(org.w3c.dom.Element project)
      • hasArtifactIdInModules

        private static boolean hasArtifactIdInModules​(java.lang.String artifactId,
                                                      org.w3c.dom.Node modules)