Ejemplo n.º 1
0
 def artifactId(self):
     """
     Effective artifactId of the pom Artifact
     """
     aId = POMReader.find(self.__doc, './pom:artifactId')
     if aId is None:
         raise PomLoadingException("Unable to determine artifactId")
     if len(aId) != 0:
         raise PomLoadingException(
             "Unexpected child nodes under artifactId")
     return aId.text.strip()
Ejemplo n.º 2
0
 def groupId(self):
     """
     Effective groupId of the pom Artifact taking into account parent groupId
     """
     gId = POMReader.find(self.__doc, './pom:groupId')
     if gId is None:
         gId = POMReader.find(self.__doc, './pom:parent/pom:groupId')
     if gId is None:
         raise PomLoadingException("Unable to determine groupId")
     if len(gId) != 0:
         raise PomLoadingException("Unexpected child nodes under groupId")
     return gId.text.strip()
Ejemplo n.º 3
0
 def version(self):
     """
     Effective version of the pom Artifact taking into account parent
     version
     """
     version = POMReader.find(self.__doc, './pom:version')
     if version is None:
         version = POMReader.find(self.__doc, './pom:parent/pom:version')
     if version is None:
         raise PomLoadingException("Unable to determine artifact version")
     if len(version) != 0:
         raise PomLoadingException("Unexpected child nodes under version")
     return version.text.strip()
Ejemplo n.º 4
0
 def artifactId(self):
     aId = POMReader.find(self.__doc, '/ivy-module/info')
     if aId is not None:
         try:
             aId = aId.attrib["module"]
         except KeyError:
             raise PomLoadingException("Unable to determine artifactId")
     return aId
Ejemplo n.º 5
0
 def version(self):
     version = POMReader.find(self.__doc, '/ivy-module/info')
     if version is not None:
         try:
             version = version.attrib["revision"]
         except KeyError:
             raise PomLoadingException("Unable to determine version")
     return version
Ejemplo n.º 6
0
 def groupId(self):
     gId = POMReader.find(self.__doc, '/ivy-module/info')
     if gId is not None:
         try:
             gId = gId.attrib["organisation"]
         except:
             raise PomLoadingException("Unable to determine groupId")
     return gId
Ejemplo n.º 7
0
 def artifactId(self):
     """
     Effective artifactId of the pom artifact
     """
     aId = POMReader.find(self._doc, "./pom:artifactId")
     if aId is None:
         raise PomLoadingException("Unable to determine artifactId")
     return aId.text.strip()
Ejemplo n.º 8
0
 def groupId(self):
     """
     Effective groupId of the pom artifact taking into account parent groupId
     """
     gId = POMReader.find(self._doc, "./pom:groupId")
     if gId is None:
         gId = POMReader.find(self._doc, "./pom:parent/pom:groupId")
     if gId is None:
         raise PomLoadingException("Unable to determine groupId")
     return gId.text.strip()
Ejemplo n.º 9
0
 def packaging(self):
     """
     Packaging type of artifact or None if unspecified
     """
     packaging = POMReader.find(self.__doc, './pom:packaging')
     if packaging is None:
         # use default packaging type
         return "jar"
     if len(packaging) != 0:
         raise PomLoadingException("Unexpected child nodes under packaging")
     return packaging.text.strip()
Ejemplo n.º 10
0
 def version(self):
     """
     Effective version of the pom artifact taking into account parent
     version
     """
     version = POMReader.find(self._doc, "./pom:version")
     if version is None:
         version = POMReader.find(self._doc, "./pom:parent/pom:version")
     if version is None:
         raise PomLoadingException("Unable to determine artifact version")
     return version.text.strip()
Ejemplo n.º 11
0
 def __init__(self, path):
     if not path:
         raise PomLoadingException("Path \"{p}\" is invalid".format(p=path))
     self._doc = POMReader.load(path)
     self._path = os.path.join(path)