Return a MavenPom object from a POM file at `location` or provided as a `text` string.
(location=None, text=None)
| 989 | |
| 990 | |
| 991 | def 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 | |
| 1022 | SUPPORTED_PACKAGING = set([ |