Ensure JAVA_HOME is properly defined
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 26 Nov 2022 10:10:37 +0000 (11:10 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 26 Nov 2022 10:10:37 +0000 (11:10 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.xmake.cfg
Dockerfile

index e6c9cd4e181c166ab5f5a98ccef68c70390cfab8..ee598d0c1e0380fd54fc4d700839ff4894b892d3 100644 (file)
@@ -1,5 +1,5 @@
 [xmake]
-version=1.0.9
+version=1.0.10
 # https://github.wdf.sap.corp/pages/xmake-ci/User-Guide/Setting_up_a_Build/Release_Procedure/Release_Versions/
 
 [buildplugin]
index dcb4c74cd1dd6661d7eadad969aa74329aa0383e..3942c2d4bd56d7ce177eb948f6bad1bd064cc74e 100644 (file)
@@ -113,7 +113,10 @@ RUN set -ex \
 
 ARG SAPMACHINE_VERSION=11.0.17
 
-RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
+ENV JAVA_HOME /opt/jdk
+
+RUN ARCH=; SAPMACHINE_MAJOR_VERSION=$(echo ${SAPMACHINE_VERSION} | cut -d. -f1) \
+    && dpkgArch="$(dpkg --print-architecture)" \
     && case "${dpkgArch##*-}" in \
       amd64) ARCH='amd64';; \
       *) echo "unsupported architecture"; exit 1 ;; \
@@ -132,9 +135,10 @@ RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
   && chmod 644 /etc/apt/trusted.gpg.d/sapmachine.gpg \
   && echo "deb http://dist.sapmachine.io/debian/${ARCH}/ ./" | tee /etc/apt/sources.list.d/sapmachine.list \
   && apt-get update \
-  && apt-get install -y sapmachine-$(echo ${SAPMACHINE_VERSION} | cut -d. -f1)-jdk=${SAPMACHINE_VERSION} --no-install-recommends \
+  && apt-get install -y sapmachine-${SAPMACHINE_MAJOR_VERSION}-jdk=${SAPMACHINE_VERSION} --no-install-recommends \
   && rm -rf "$GNUPGHOME" /var/lib/apt/lists/* \
   && apt-get remove --purge --autoremove -y ca-certificates gnupg dirmngr \
+  && ln -s /usr/lib/jvm/sapmachine-${SAPMACHINE_MAJOR_VERSION} ${JAVA_HOME} \
   # smoke test
   && java -version