Class PomUtils
java.lang.Object
org.apache.maven.archetype.common.util.PomUtils
public final class PomUtils
extends java.lang.Object
POM helper class.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
addNewModule
(java.lang.String artifactId, java.io.Reader fileReader, java.io.Writer fileWriter) Adds moduleartifactId
unless the module already presents infileReader
.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 Details
-
PomUtils
private PomUtils()
-
-
Method Details
-
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 moduleartifactId
unless the module already presents infileReader
.- Parameters:
artifactId
- artifactId of module to addfileReader
- source POM XMLfileWriter
- target XML- Returns:
true
if modules section in POM is empty or does not exist orartifactId
does not appear a module infileReader
XML.- Throws:
java.io.IOException
- if I/O errorInvalidPackaging
- if packaging is not "pom" or not exist in POMArchetypeTemplateProcessingException
- if "project" does not exist or "modules" element is duplicatedjavax.xml.parsers.ParserConfigurationException
- if parser errororg.xml.sax.SAXException
- if parser errorjavax.xml.transform.TransformerException
- if an error writing tofileWriter
-
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)
-