maven plugin should install maven build-package
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
maven plugin does not install maven build-package.
In order to use maven plugin the image should have maven installed already which is inconvenient.
Would it be possible to append
```
build-packages:
- maven
- openjdk-21-jdk-headless
```
if the part does not contain 'build-packages'
### To Reproduce
1. create a rockcraft application with a maven part.
2. rockcraft pack
### part yaml
```shell
application:
plugin: maven
source: sample
source-type: local
```
### Relevant log output
```shell
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.441 plugin validation command: 'mvn --version'
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.443 Environment validation failed for part 'application': 'mvn' not found and part 'application' does not depend on a part named 'maven-deps' that would satisfy the dependency.
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 Traceback (most recent call last):
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/plugins/validator.py", line 101, in validate_dependency
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 output = self._execute(command).strip()
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/plugins/validator.py", line 145, in _execute
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 proc = subprocess.run(
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 File "/snap/rockcraft/2374/usr/lib/python3.10/subprocess.py", line 526, in run
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 raise CalledProcessError(retcode, process.args,
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 subprocess.CalledProcessError: Command '['/bin/bash', '/tmp/tmpx0rd72pf']' returned non-zero exit status 127.
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 The above exception was the direct cause of the following exception:
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 Traceback (most recent call last):
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_application/services/lifecycle.py", line 256, in run
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 with self._lcm.action_executor() as aex:
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 304, in __enter__
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 self._executor.prologue()
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 91, in prologue
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 self._verify_plugin_environment()
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.444 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 290, in _verify_plugin_environment
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.445 validator.validate_environment(part_dependencies=part.dependencies)
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.445 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/plugins/maven_plugin.py", line 64, in validate_environment
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.445 version = self.validate_dependency(
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.445 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/plugins/validator.py", line 118, in validate_dependency
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.445 raise errors.PluginEnvironmentValidationError(
2024-08-16 11:32:31.728 :: 2024-08-16 11:32:31.445 craft_parts.errors.PluginEnvironmentValidationError: Environment validation failed for part 'application': 'mvn' not found and part 'application' does not depend on a part named 'maven-deps' that would satisfy the dependency.
2024-08-16 11:32:31.729 Executing on host: lxc --project rockcraft config device show local:rockcraft-maven-sample-chisel-on-amd64-for-amd64-61079577
2024-08-16 11:32:31.820 Executing on host: lxc --project rockcraft config device remove local:rockcraft-maven-sample-chisel-on-amd64-for-amd64-61079577 disk-/root/project
2024-08-16 11:32:31.954 Executing on host: lxc --project rockcraft stop local:rockcraft-maven-sample-chisel-on-amd64-for-amd64-61079577
2024-08-16 11:32:35.883 Failed to execute rockcraft in instance.
2024-08-16 11:32:35.885 Traceback (most recent call last):
2024-08-16 11:32:35.885 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_application/application.py", line 376, in run_managed
2024-08-16 11:32:35.885 instance.execute_run( # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]
2024-08-16 11:32:35.885 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_providers/lxd/lxd_instance.py", line 293, in execute_run
2024-08-16 11:32:35.885 return self.lxc.exec(
2024-08-16 11:32:35.885 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_providers/lxd/lxc.py", line 387, in exec
2024-08-16 11:32:35.885 return runner(final_cmd, timeout=timeout, check=check, **kwargs)
2024-08-16 11:32:35.885 File "/snap/rockcraft/2374/usr/lib/python3.10/subprocess.py", line 526, in run
2024-08-16 11:32:35.885 raise CalledProcessError(retcode, process.args,
2024-08-16 11:32:35.885 subprocess.CalledProcessError: Command '['lxc', '--project', 'rockcraft', 'exec', 'local:rockcraft-maven-sample-chisel-on-amd64-for-amd64-61079577', '--cwd', '/root/project', '--', 'env', 'CRAFT_MANAGED_MODE=1', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'CRAFT_PLATFORM=amd64', 'CRAFT_VERBOSITY_LEVEL=BRIEF', 'rockcraft', 'pack']' returned non-zero exit status 1.
2024-08-16 11:32:35.885
2024-08-16 11:32:35.885 The above exception was the direct cause of the following exception:
2024-08-16 11:32:35.885 Traceback (most recent call last):
2024-08-16 11:32:35.885 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_application/application.py", line 541, in run
2024-08-16 11:32:35.885 self.run_managed(platform, build_for)
2024-08-16 11:32:35.885 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_application/application.py", line 383, in run_managed
2024-08-16 11:32:35.885 raise craft_providers.ProviderError(
2024-08-16 11:32:35.885 craft_providers.errors.ProviderError: Failed to execute rockcraft in instance.
2024-08-16 11:32:35.885 Full execution log: '/home/vladimirp/.local/state/rockcraft/log/rockcraft-20240816-113034.715917.log'
```
Evaluation history
No evaluation history available.