craft_parts.utils.maven.common module¶
Utilities for Maven projects and settings.
- class craft_parts.utils.maven.common.MavenArtifact(group_id, artifact_id, version, packaging_type, field_name='Dependency')¶
Bases:
objectA dataclass for Maven artifacts.
- Parameters:
- classmethod from_element(element, namespaces)¶
Create a MavenArtifact from an XML artifact element.
- classmethod from_pom(pom)¶
Create a MavenArtifact from a pom file.
- Parameters:
pom (
Path)- Return type:
Self
- classmethod update_versions(project, namespaces, existing)¶
Update all of the versions for this project as necessary.
- class craft_parts.utils.maven.common.MavenParent(group_id, artifact_id, version, packaging_type, field_name='Parent')¶
Bases:
MavenArtifactA dataclass for the Maven parent tag.
- Parameters:
- class craft_parts.utils.maven.common.MavenPlugin(group_id, artifact_id, version, packaging_type, field_name='Plugin')¶
Bases:
MavenArtifactA dataclass for Maven plugins.
These are different because plugins have a default groupId.
- Parameters:
- classmethod from_element(element, namespaces)¶
Create a MavenPlugin from an XML plugin element.
If no groupId is found, ‘org.apache.maven.plugins’ will be used.
For more information on the default plugin group, see: https://maven.apache.org/guides/mini/guide-configuring-plugins.html
- exception craft_parts.utils.maven.common.MavenXMLError(message, details=None)¶
Bases:
BaseExceptionAn error encountered while parsing XML for Maven projects.
- craft_parts.utils.maven.common.create_maven_settings(*, part_info, set_mirror)¶
Create a Maven configuration file.
The settings file contains additional configuration for Maven, such as proxy parameters and a reference to the backstage repository.
- craft_parts.utils.maven.common.update_pom(*, part_info, deploy_to, self_contained, pom_file=None)¶
Update the POM file of a Maven project.
- Parameters:
part_info (
PartInfo) – Information about the invoking part.deploy_to (
Path|None) – The path to configure the mvn deploy location. If None, no path is configured.self_contained (
bool) – Whether or not to patch version numbers with what is actually available.pom_file (
Path|None) – The optional Maven POM file to update. IfNone, the function will try to usepom.xmlon the part’s build subdir.
- Return type: