craft_parts.plugins.maven_plugin module

The maven plugin.

class craft_parts.plugins.maven_plugin.MavenPlugin(*, properties, part_info)[source]

Bases: JavaPlugin

A plugin to build parts that use Maven.

The Maven build system is commonly used to build Java projects. This plugin requires a pom.xml in the root of the source tree.

This plugin uses the common plugin keywords as well as those for “sources”. For more information check the ‘plugins’ topic for the former and the ‘sources’ topic for the latter.

Additionally, this plugin uses the following plugin-specific keywords:

  • maven-parameters: (list of strings) Flags to pass to the build using the maven semantics for parameters.

Parameters:
get_build_commands()[source]

Return a list of commands to run during the build step.

Return type:

list[str]

get_build_packages()[source]

Return a set of required packages to install in the build environment.

Return type:

set[str]

get_build_snaps()[source]

Return a set of required snaps to install in the build environment.

Return type:

set[str]

properties_class

alias of MavenPluginProperties

validator_class

alias of MavenPluginEnvironmentValidator

class craft_parts.plugins.maven_plugin.MavenPluginEnvironmentValidator(*, part_name, env, properties)[source]

Bases: PluginEnvironmentValidator

Check the execution environment for the maven plugin.

Parameters:
  • part_name (str) – The part whose build environment is being validated.

  • env (str) – A string containing the build step environment setup.

  • properties (PluginProperties)

validate_environment(*, part_dependencies=None)[source]

Ensure the environment contains dependencies needed by the plugin.

Parameters:

part_dependencies (Optional[list[str]]) – A list of the parts this part depends on.

Raises:

PluginEnvironmentValidationError – If go is invalid and there are no parts named go.

Return type:

None

class craft_parts.plugins.maven_plugin.MavenPluginProperties(**data)[source]

Bases: PluginProperties

The part properties used by the maven plugin.

Parameters:

data (Any)

maven_parameters: list[str]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'alias_generator': <function PluginProperties.<lambda>>, 'extra': 'forbid', 'frozen': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'maven_parameters': FieldInfo(annotation=list[str], required=False, default=[], alias='maven-parameters', alias_priority=1), 'plugin': FieldInfo(annotation=Literal['maven'], required=False, default='maven', alias='plugin', alias_priority=1), 'source': FieldInfo(annotation=str, required=True, alias='source', alias_priority=1)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

plugin: Literal['maven']
source: str