java plugin should not link java under /bin
Metadata
Current evaluation
Java plugin hardcodes a /bin/java symlink, causing stage collisions in rockcraft builds. Maintainer acknowledged (Aug 2024) that an override option is needed but details are unresolved; no fix implemented, issue still open.
Suggested action: keep open
Reason: Maintainer lengau explicitly acknowledged the issue on 2024-08-30, saying it 'makes a lot of sense' paired with the jlink plugin and 'we'll just need to figure out details', indicating triaged buy-in. The current code still hardcodes ${CRAFT_PART_INSTALL}/bin/java in _get_java_link_commands, so the problem persists. Inactivity alone (~18 months) is not sufficient to close since the maintainer endorsed the direction.
Impact:
50
Quick Win:
22.5
Staleness:
62
Complexity:
55
Confidence:
70
Support Request:
10
Issue body
### Bug Description
Java plugin attempts to link java executable under /bin.
This causes conflict with the other parts writing to /bin.
### To Reproduce
1. rockcraft pack attached project
### part yaml
```shell
name: maven-sample-chisel
version: 0.0.1
summary: Sample Maven-based chiselled rock
description: |
This image is a sample maven application
using openjdk-21-jre-headless slices
base: bare
build-base: ubuntu@24.04
run-user: _daemon_
platforms:
amd64:
services:
test:
override: replace
summary: Service summary
command: /usr/lib/jvm/java-21-openjdk-amd64/bin/java -jar /jars/sample-0.0.1-SNAPSHOT.jar
startup: enabled
parts:
application:
plugin: maven
source: ./sample
source-type: local
build-packages:
- maven
- openjdk-21-jdk
runtime:
plugin: nil
source: https://github.com/vpa1977/chisel-releases
source-type: git
source-branch: 24.04-openjdk-21-jre-headless
build-packages:
- ca-certificates-java
override-build: |
chisel cut --release ./ --root ${CRAFT_PART_INSTALL} \
base-files_base openjdk-21-jre-headless_security
mkdir -p ${CRAFT_PART_INSTALL}/etc/ssl/certs/java/
cp /etc/ssl/certs/java/cacerts ${CRAFT_PART_INSTALL}/etc/ssl/certs/java/cacerts
```
### Relevant log output
```shell
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.322 Staging application
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.322 execute action application:Action(part_name='application', step=Step.STAGE, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.347 Failed to stage: parts list the same file with different contents or permissions.
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.347 Detailed information: Parts 'runtime' and 'application' list the following files, but with different contents or permissions:
2024-08-16 11:47:22.717 :: bin
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 Traceback (most recent call last):
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_application/services/lifecycle.py", line 261, in run
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 aex.execute(action, stdout=stream, stderr=stream)
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 324, in execute
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 self._executor.execute(actions, stdout=stdout, stderr=stderr)
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 136, in execute
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 self._run_action(act, stdout=stdout, stderr=stderr)
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/executor/executor.py", line 206, in _run_action
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 check_for_stage_collisions(
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/executor/collisions.py", line 59, in check_for_stage_collisions
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 _check_for_stage_collisions_per_partition(part_list, partition)
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_parts/executor/collisions.py", line 111, in _check_for_stage_collisions_per_partition
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 raise errors.PartFilesConflict(
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 craft_parts.errors.PartFilesConflict: Failed to stage: parts list the same file with different contents or permissions.
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 Parts 'runtime' and 'application' list the following files, but with different contents or permissions:
2024-08-16 11:47:22.717 :: 2024-08-16 11:47:22.348 bin
2024-08-16 11:47:22.717 Executing on host: lxc --project rockcraft config device show local:rockcraft-maven-sample-chisel-on-amd64-for-amd64-61079577
2024-08-16 11:47:22.813 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:47:22.957 Executing on host: lxc --project rockcraft stop local:rockcraft-maven-sample-chisel-on-amd64-for-amd64-61079577
2024-08-16 11:47:27.024 Failed to execute rockcraft in instance.
2024-08-16 11:47:27.026 Traceback (most recent call last):
2024-08-16 11:47:27.026 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_application/application.py", line 376, in run_managed
2024-08-16 11:47:27.026 instance.execute_run( # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]
2024-08-16 11:47:27.026 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_providers/lxd/lxd_instance.py", line 293, in execute_run
2024-08-16 11:47:27.026 return self.lxc.exec(
2024-08-16 11:47:27.026 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_providers/lxd/lxc.py", line 387, in exec
2024-08-16 11:47:27.026 return runner(final_cmd, timeout=timeout, check=check, **kwargs)
2024-08-16 11:47:27.026 File "/snap/rockcraft/2374/usr/lib/python3.10/subprocess.py", line 526, in run
2024-08-16 11:47:27.026 raise CalledProcessError(retcode, process.args,
2024-08-16 11:47:27.026 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:47:27.026
2024-08-16 11:47:27.026 The above exception was the direct cause of the following exception:
2024-08-16 11:47:27.026 Traceback (most recent call last):
2024-08-16 11:47:27.026 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_application/application.py", line 541, in run
2024-08-16 11:47:27.026 self.run_managed(platform, build_for)
2024-08-16 11:47:27.026 File "/snap/rockcraft/2374/lib/python3.10/site-packages/craft_application/application.py", line 383, in run_managed
2024-08-16 11:47:27.026 raise craft_providers.ProviderError(
2024-08-16 11:47:27.026 craft_providers.errors.ProviderError: Failed to execute rockcraft in instance.
2024-08-16 11:47:27.026 Full execution log: '/home/vladimirp/.local/state/rockcraft/log/rockcraft-20240816-114556.473928.log'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.8-27b |
Impact:
50
Quick Win:
22.5
Staleness:
62
Complexity:
55
Confidence:
70
Support Request:
10
|
keep open | Java plugin hardcodes a /bin/java symlink, causing stage collisions in rockcraft builds. Maintainer acknowledged (Aug 2024) that an override option is needed but details are unresolved; no fix implemented, issue still open. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
75
Complexity:
65
Confidence:
65
Support Request:
10
|
keep open | Java plugin links java executable to /bin, causing staging collisions in rockcraft builds. Maintainers discussed backwards compatibility and potential override options, but no resolution has been implemented. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
60
Confidence:
75
Support Request:
5
|
keep open | Java plugin links java to /bin causing staging collisions. Maintainer acknowledged the conflict and suggested adding a configurable path override, but implementation details remain unresolved. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
70
Complexity:
60
Confidence:
80
Support Request:
10
|
keep open | Java plugin links executable to /bin, causing staging conflicts. Maintainers discuss backwards compatibility and an override option to relocate Java, potentially integrating with a jlink plugin. State: under discussion. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #752 feat: do not create /bin/java symlink | rockcraft | merged | Merged PR overrides maven and ant plugins to prevent creating a /bin/java symlink, resolving craft-parts issue #813 and enabling rock builds. Approved by two reviewers. Follow-up PR #916 handles documentation overrides. |