The version of Java (1.8.0_292) you have used to run this analysis is deprecated and we stopped accepting it. Please update to at least Java 11

while trying to initiate a sonar scan from Bitrise, I encountered the error “The version of Java (1.8.0_292) you have used to run this analysis is deprecated and we stopped accepting it.
Please update to at least Java 11”. My Java environment in Bitrise shows everything has java version 11. Need some help here.

Steps in my Bitrise pipeline:

added a script step before my sonarscanner step.
Content of script step

#!/bin/bash
set -ex
add-apt-repository -y ppa:openjdk-r/ppa
apt-get update -qq
apt-get install -y openjdk-11-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
java -version
javac -version
echo $JAVA_HOME

This step sets java version 11.

Hello,

All stacks have Java 8 and Java 11 installed, with Java 8 used by default. Please try switching to Java 11 by using a script step containing:

For macOS-based stacks:

jenv global 11
export JAVA_HOME="$(jenv prefix)"
envman add --key JAVA_HOME --value "$(jenv prefix)" 

For Ubuntu-based stacks:

sudo update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac
sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
   
export JAVA_HOME='/usr/lib/jvm/java-11-openjdk-amd64'
envman add --key JAVA_HOME --value '/usr/lib/jvm/java-11-openjdk-amd64'
1 Like

This works for me, thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.