Skip to content

Commit 1e6f5cc

Browse files
committed
Open JDK modules for E2E app containers
1 parent 6e1290c commit 1e6f5cc

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

e2e-test/e2e-test-builder/src/main/resources/template/application-dockerFile.ftl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ echo "Hostname: $(hostname)"\n\
3636
echo "Start Time: $(date)"\n\
3737
echo "=========================================="\n\
3838
echo "Starting Application..."\n\
39-
exec java -jar app.jar\n' > /startup.sh && \
39+
JAVA_VERSION_STRING=$(java -version 2>&1 | head -n 1 | cut -d \\" -f 2)\n\
40+
JAVA_VERSION=$(echo "$JAVA_VERSION_STRING" | cut -d . -f 1)\n\
41+
if [ "$JAVA_VERSION" = "1" ]; then\n\
42+
JAVA_VERSION=$(echo "$JAVA_VERSION_STRING" | cut -d . -f 2)\n\
43+
fi\n\
44+
JAVA_OPTS="$JAVA_OPTS"\n\
45+
if [ "$JAVA_VERSION" -ge 9 ] 2>/dev/null; then\n\
46+
JAVA_OPTS="$JAVA_OPTS --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED"\n\
47+
fi\n\
48+
exec java $JAVA_OPTS -jar app.jar\n' > /startup.sh && \
4049
chmod +x /startup.sh
4150

4251
ENTRYPOINT ["/startup.sh"]

0 commit comments

Comments
 (0)