Пример #1
0
 def extensions(self):
     """
     List of artifact's extensions
     """
     xmlnodes = POMReader.xpath(self.__doc,
                                './pom:build/pom:extensions/pom:extension')
     return [Extension.from_xml_element(x) for x in xmlnodes]
Пример #2
0
 def plugins(self):
     """
     List of artifact's plugins
     """
     xmlnodes = POMReader.xpath(self.__doc,
                                './pom:build/pom:plugins/pom:plugin')
     return [Plugin.from_xml_element(x) for x in xmlnodes]
Пример #3
0
 def pluginManagement(self):
     """
     List of plugins from plugin management section
     """
     xmlnodes = POMReader.xpath(
         self.__doc, './pom:pluginManagement/pom:plugins/pom:plugin')
     return [Plugin.from_xml_element(x) for x in xmlnodes]
Пример #4
0
 def dependencies(self):
     """
     List of artifact's dependencies
     """
     xmlnodes = POMReader.xpath(self.__doc,
                                './pom:dependencies/pom:dependency')
     return [Dependency.from_xml_element(x) for x in xmlnodes]
Пример #5
0
 def dependencyManagement(self):
     """
     List of dependencies from dependency management section
     """
     xmlnodes = POMReader.xpath(
         self.__doc,
         './pom:dependencyManagement/pom:dependencies/pom:dependency')
     return [Dependency.from_xml_element(x) for x in xmlnodes]
Пример #6
0
    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)