Add run-java script
All checks were successful
moparisthebest/self-ci/pipeline/head This commit looks good
All checks were successful
moparisthebest/self-ci/pipeline/head This commit looks good
This commit is contained in:
parent
ab8ba7fdc1
commit
022e12a487
@ -22,7 +22,7 @@ RUN mkdir /m2 /npm && ln -sf /m2/ /root/.m2 && ln -sf /npm/ /root/.npm && \
|
||||
curl https://download.java.net/java/early_access/jdk16/23/GPL/openjdk-16-ea+23_linux-x64_bin.tar.gz | bsdtar -xf - -C /usr/lib/jvm && \
|
||||
mv /usr/lib/jvm/java-se-9-ri/jdk-9 /usr/lib/jvm/ && rm -rf java-se-9-ri && chmod +x /usr/lib/jvm/jdk-9/bin/*
|
||||
|
||||
COPY ./build.sh /usr/bin/
|
||||
COPY ./build.sh ./run-java /usr/bin/
|
||||
|
||||
VOLUME [ "/build", "/m2", "/npm" ]
|
||||
|
||||
|
@ -1,19 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
for jdk in ${BUILD_JDKS:-java-6-jdk java-7-openjdk java-8-openjdk jdk-9 jdk-10 java-11-openjdk jdk-12 jdk-13 java-14-openjdk jdk-15 jdk-16}
|
||||
for jdk in ${BUILD_JDKS:-6 7 8 9 10 11 12 13 14 15 16}
|
||||
do
|
||||
sudo archlinux-java set "$jdk"
|
||||
|
||||
export JAVA_VERSION="$(echo "$jdk" | grep -Eo '[0-9]+')"
|
||||
export JAVA_HOME="/usr/lib/jvm/$jdk"
|
||||
|
||||
export M2_HOME="/opt/maven"
|
||||
|
||||
# maven 3.2.5 is the latest version supported by 6
|
||||
[ $JAVA_VERSION -eq 6 ] && export M2_HOME="/opt/apache-maven-3.2.5"
|
||||
|
||||
export PATH="$JAVA_HOME/bin:$M2_HOME/bin:$PATH"
|
||||
echo "building with JAVA_VERSION='$JAVA_VERSION' JAVA_HOME='$JAVA_HOME'"
|
||||
"$@"
|
||||
run-java "$jdk" "$@"
|
||||
done
|
||||
|
65
java/run-java
Executable file
65
java/run-java
Executable file
@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
# first arg can be a numeric version, or a folder in /usr/lib/jvm/
|
||||
jdk="$1"
|
||||
shift
|
||||
|
||||
JAVA_HOME="/usr/lib/jvm/$jdk"
|
||||
|
||||
M2_HOME="/opt/maven"
|
||||
|
||||
if [ ! -d "$JAVA_HOME" ]
|
||||
then
|
||||
# it's probably a number
|
||||
JAVA_VERSION="$jdk"
|
||||
|
||||
case "$JAVA_VERSION" in
|
||||
6)
|
||||
jdk=java-6-jdk
|
||||
;;
|
||||
7)
|
||||
jdk=java-7-openjdk
|
||||
;;
|
||||
8)
|
||||
jdk=java-8-openjdk
|
||||
;;
|
||||
9)
|
||||
jdk=jdk-9
|
||||
;;
|
||||
10)
|
||||
jdk=jdk-10
|
||||
;;
|
||||
11)
|
||||
jdk=java-11-openjdk
|
||||
;;
|
||||
12)
|
||||
jdk=jdk-12
|
||||
;;
|
||||
13)
|
||||
jdk=jdk-13
|
||||
;;
|
||||
14)
|
||||
jdk=java-14-openjdk
|
||||
;;
|
||||
15)
|
||||
jdk=jdk-15
|
||||
;;
|
||||
16)
|
||||
jdk=jdk-16
|
||||
;;
|
||||
*)
|
||||
echo "run-java: unknown jdk: $jdk"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
JAVA_HOME="/usr/lib/jvm/$jdk"
|
||||
else
|
||||
# it's a folder
|
||||
JAVA_VERSION="$(echo "$jdk" | grep -Eo '[0-9]+')"
|
||||
fi
|
||||
|
||||
# maven 3.2.5 is the latest version supported by 6
|
||||
[ $JAVA_VERSION -eq 6 ] && export M2_HOME="/opt/apache-maven-3.2.5"
|
||||
|
||||
JAVA_VERSION=$JAVA_VERSION M2_HOME="$M2_HOME" JAVA_HOME="$JAVA_HOME" PATH="$JAVA_HOME/bin:$M2_HOME/bin:$PATH" exec "$@"
|
Loading…
Reference in New Issue
Block a user