def get_maven_pom(location=None, text=None, check_is_pom=False, extra_properties=None): """ Return a MavenPom object from a POM file at `location` or provided as a `text` string. """ if location and check_is_pom and not is_pom(location): return pom = MavenPom(location, text) if not extra_properties: extra_properties = {} # do we have a pom.properties file side-by-side? if location and os.path.exists(location): parent = fileutils.parent_directory(location) pom_properties = os.path.join(parent, 'pom.properties') if os.path.exists(pom_properties): with open(pom_properties) as props: properties = javaproperties.load(props) or {} if TRACE: logger.debug('_get_mavenpom: properties: {}'.format(repr(properties))) extra_properties.update(properties) pom.resolve(**extra_properties) # TODO: we cannot do much without these?? if check_is_pom and not has_basic_pom_attributes(pom): if TRACE: logger.debug('_get_mavenpom: has_basic_pom_attributes: {}'.format( has_basic_pom_attributes(pom))) return return pom
def get_maven_pom(location=None): """ Return a MavenPom object from a POM file at `location` or provided as a `text` string. """ pom = MavenPom(location=location) extra_properties = {} # do we have a pom.properties file side-by-side? # FIXME: we should treat pom.properties as a datafile if location and os.path.exists(location): parent = fileutils.parent_directory(location) pom_properties = os.path.join(parent, 'pom.properties') if os.path.exists(pom_properties): with open(pom_properties) as props: properties = javaproperties.load(props) or {} if TRACE: logger.debug(f'get_maven_pom: properties: {properties!r}') extra_properties.update(properties) pom.resolve(**extra_properties) # TODO: we cannot do much without these?? hbpa = has_basic_pom_attributes(pom) if not hbpa: if TRACE: logger.debug(f'get_maven_pom: has_basic_pom_attributes: {hbpa}') return return pom
def _get_mavenpom(location, check_is_pom=False): if check_is_pom and not is_pom(location): return pom = MavenPom(location) pom.resolve() if check_is_pom and not (pom.model_version and pom.group_id and pom.artifact_id): return return pom
def _get_mavenpom(location=None, text=None, check_is_pom=False, extra_properties=None): if location and check_is_pom and not is_pom(location): return pom = MavenPom(location, text) if not extra_properties: extra_properties = {} pom.resolve(**extra_properties) # TODO: we cannot do much without these?? if check_is_pom and not has_basic_pom_attributes(pom): return return pom