Skip to content

Commit d55145b

Browse files
committed
[OPENJDK-2736] jlink pre-flight check for jmods
Fail early and clearly if we don't have the jmods available for Jlink integration (or the JDK version isn't right) https://issues.redhat.com/browse/OPENJDK-2736 Signed-off-by: Jonathan Dowland <[email protected]>
1 parent 8c50624 commit d55145b

File tree

2 files changed

+15
-0
lines changed
  • modules

2 files changed

+15
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
jlink_preflight_check()
2+
{
3+
# preflight check: do we have what we need?
4+
if [ "$JAVA_VERSION" -lt 11 ]; then
5+
echo "Jlink integration not available for JDK${JAVA_VERSION}!"
6+
echo "Jlink integration is only supported for JDK versions 11 and newer."
7+
fi
8+
if [ ! -d /usr/lib/jvm/java/jmods ]; then
9+
echo "Jlink integration requires the jmods RPM to be installed in the builder image, e.g."
10+
echo " microdnf install -y java-${JAVA_VERSION}-openjdk-jmods"
11+
fi
12+
}

modules/s2i/bash/artifacts/usr/local/s2i/assemble

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ setup_java_app_and_lib
2121
# include our jlink scripts
2222
if [ "$S2I_ENABLE_JLINK" = "true" ]; then
2323

24+
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/preflight.sh"
25+
jlink_preflight_check
26+
2427
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh"
2528
echo "Invoking mkdeps"
2629
generate_deps

0 commit comments

Comments
 (0)