How do I upgrade the Java Version in a SonarScan?

122 views Asked by At

I have a Concourse pipeline that runs a SonarQube Scan. Since the Sonar Scan uses Java, we need to make sure our Sonar Scan uses the appropriate version. I'm trying to update the Java version to 11 but the pipeline is still pointing to Java 1.8.

Here is my Sonar Properties file:

sonar.sourceEncoding=UTF-8
sonar.sources=server/src
sonar.exclusions=server/src/tests/**
sonar.projectBaseDir=.
sonar.java.source=11

As you can see I changed the source from 1.8 to 11.

This change had no effect on the pipeline identifying the intended Java version.

Here is my sonar.yml file. I tried replacing the repository url with "java11" instead of "node".

platform: linux
image_resource:
  type: docker-image
  source:
    repository: docker.artifactory.company.com/flow/java11
    tag: "latest"
    username: ((user))
    password: ((password))
inputs:
  - name: code-repo
caches:
  - path: code-repo/server/node_modules
run:
  dir: code-repo
  path: cicd/scripts/sonar.sh

This change just broke the pipeline step.

Finally here is my sonar.sh file.

set -e
npm install -g n
n 14.16.0
node -v
npm -v

cd server/
export token=$(command to get token)

echo "registry = npm registry url

npm ci
cd ..
flow sonar scan $ENVIRONMENT

Thank you in advance!

0

There are 0 answers