MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / get_maven_pom

Function get_maven_pom

src/packagedcode/maven.py:991–1019  ·  view source on GitHub ↗

Return a MavenPom object from a POM file at `location` or provided as a `text` string.

(location=None, text=None)

Source from the content-addressed store, hash-verified

989
990
991def get_maven_pom(location=None, text=None):
992 """
993 Return a MavenPom object from a POM file at `location` or provided as a
994 `text` string.
995 """
996 pom = MavenPom(location=location, text=text)
997
998 extra_properties = {}
999
1000 # do we have a pom.properties file side-by-side?
1001 # FIXME: we should treat pom.properties as a datafile
1002 if location and os.path.exists(location):
1003 parent = fileutils.parent_directory(location)
1004 pom_properties = os.path.join(parent, 'pom.properties')
1005 if os.path.exists(pom_properties):
1006 with open(pom_properties) as props:
1007 properties = javaproperties.load(props) or {}
1008 if TRACE:
1009 logger.debug(f'get_maven_pom: properties: {properties!r}')
1010 extra_properties.update(properties)
1011 pom.resolve(**extra_properties)
1012 # TODO: we cannot do much without these??
1013 hbpa = has_basic_pom_attributes(pom)
1014
1015 if not hbpa:
1016 if TRACE:
1017 logger.debug(f'get_maven_pom: has_basic_pom_attributes: {hbpa}')
1018 return
1019 return pom
1020
1021
1022SUPPORTED_PACKAGING = set([

Callers 1

_parseFunction · 0.85

Calls 8

resolveMethod · 0.95
MavenPomClass · 0.85
has_basic_pom_attributesFunction · 0.85
existsMethod · 0.45
joinMethod · 0.45
loadMethod · 0.45
debugMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected