Skip to content

Commit

Permalink
fix: only drop /bin/java symlink
Browse files Browse the repository at this point in the history
Maven plugin in rockcraft will work if we drop /bin/java symlink.
The JAVA_HOME variable will be set by java plugin
  • Loading branch information
vpa1977 committed Nov 6, 2024
1 parent 5bc22b6 commit fae4383
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
7 changes: 0 additions & 7 deletions rockcraft/plugins/maven_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,9 @@ class MavenPlugin(maven_plugin.MavenPlugin):
use and install the Java VM. Specifically:
- Do not link java executable to /bin/java
- Do not include staging area in the PATH
"""

@override
def _get_java_link_commands(self) -> list[str]:
"""Get the bash commands to provide /bin/java symlink."""
return []

@override
def get_build_environment(self) -> dict[str, str]:
env = super().get_build_environment()
env["PATH"] = "/usr/bin:$PATH"
return env
6 changes: 0 additions & 6 deletions tests/spread/rockcraft/plugin-maven/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ execute: |
# Build the rock & load it into docker
run_rockcraft pack
ls
echo expecting ${ROCK_FILE}
test -f ${ROCK_FILE}
rockcraft.skopeo copy --insecure-policy oci-archive:${ROCK_FILE} docker-daemon:${IMAGE}
docker images
rm ${ROCK_FILE}
# Run the packaged project
docker run --rm $IMAGE exec /usr/lib/jvm/java-21-openjdk-amd64/bin/java -jar /jar/sample-0.0.1-SNAPSHOT.jar | MATCH "hello world"
docker system prune -a -f
# Rebuild the java project to confirm that it rebuilds cleanly
touch sample/src/main/java/test/Test.java
rockcraft pack

0 comments on commit fae4383

Please sign in to comment.