def from_xml_element(cls, xmlnode): """ Create Extension from xml.etree.ElementTree.Element as contained within pom.xml. """ parts = {'groupId': '', 'artifactId': '', 'version': ''} parts = POMReader.find_parts(xmlnode, parts) if not parts['groupId'] or not parts['artifactId']: raise ArtifactFormatException( "Empty groupId or artifactId encountered. " "This is a bug, please report it!") return cls(parts['groupId'], parts['artifactId'], parts['version'])
def from_xml_element(cls, xmlnode): """ Create Plugin from xml.etree.ElementTree.Element as contained within pom.xml. """ parts = {'groupId': '', 'artifactId': '', 'version': ''} parts = POMReader.find_parts(xmlnode, parts) if not parts['artifactId']: raise ArtifactFormatException("Empty artifactId encountered. " "This is a bug, please report it!") # dependencies depnodes = POMReader.xpath(xmlnode, "./dependencies/dependency") deps = [] for d in [Dependency.from_xml_element(x) for x in depnodes]: deps.append(d) return cls(parts['groupId'], parts['artifactId'], parts['version'], deps)
def from_xml_element(cls, xmlnode): """ Create Dependency from xml.etree.ElementTree.Element as contained within pom.xml. """ parts = {'groupId': '', 'artifactId': '', 'type': '', 'classifier': '', 'version': '', 'scope': '', 'optional': ''} parts = POMReader.find_parts(xmlnode, parts) if not parts['groupId'] or not parts['artifactId']: raise ArtifactFormatException( "Empty groupId or artifactId encountered. " "This is a bug, please report it!") # exclusions excnodes = xmlnode.findall("{*}exclusions/{*}exclusion") exclusions = set() for e in [Exclusion.from_xml_element(x) for x in excnodes]: exclusions.add(e) return cls(parts['groupId'], parts['artifactId'], extension=parts['type'], classifier=parts['classifier'], version=parts['version'], scope=parts['scope'], optional=parts['optional'], exclusions=exclusions)