:Required Parameters:
- :java-version: Version of Java to execute Sonar with.
+ :java-version: Version of Java to execute Maven build. (default: openjdk8)
:mvn-version: Version of Maven to execute Sonar with.
:mvn-settings: Maven settings.xml file containing credentials to use.
:sonarcloud-project-key: SonarCloud project key.
:sonarcloud-project-organization: SonarCloud project organization.
:sonarcloud-api-token: SonarCloud API Token.
+ :sonarcloud-java-version: Version of Java to run the Sonar scan.
lf-maven-build
--------------
one may want to provide more than 1 cron timer. (default: 'H H * * 6'
to run weekly)
:git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
- :java-version: Version of Java to use for the build. (default: openjdk8)
+ :java-version: Version of Java to use for the Maven build. (default: openjdk8)
:mvn-global-settings: The name of the Maven global settings to use for
Maven configuration. (default: global-settings)
:mvn-goals: The maven goals to perform for the build.
:sonarcloud-project-organization: SonarCloud project organization.
(default: '')
:sonarcloud-api-token: SonarCloud API Token. (default: '')
+ :sonarcloud-java-version: Version of Java to use for the Sonar scan. (default: openjdk11)
:stream: Keyword that represents a release code-name.
Often the same as the branch. (default: master)
:submodule-recursive: Whether to checkout submodules recursively.
sonarcloud-project-key: ""
sonarcloud-project-organization: ""
sonarcloud-api-token: ""
+ # SonarCloud scan using jdk8 will become deprecated by Oct, 2020
+ # Projects not compatible with jdk11 can set java-version to something else
+ sonarcloud-java-version: openjdk11
stream: master
submodule-recursive: true
submodule-timeout: 10
sonarcloud-project-key: "{sonarcloud-project-key}"
sonarcloud-project-organization: "{sonarcloud-project-organization}"
sonarcloud-api-token: "{sonarcloud-api-token}"
+ sonarcloud-java-version: "{sonarcloud-java-version}"
# With SonarQube
- conditional-step:
condition-kind: not
PROJECT_ORGANIZATION={sonarcloud-project-organization}
MAVEN_GOALS={mvn-goals}
API_TOKEN={sonarcloud-api-token}
+ SONARCLOUD_JAVA_VERSION={sonarcloud-java-version}
- lf-provide-maven-settings:
global-settings-file: global-settings
settings-file: "{mvn-settings}"
sonarcloud-project-key: ""
sonarcloud-project-organization: ""
sonarcloud-api-token: ""
+ # SonarCloud scan using jdk8 will become deprecated by Oct, 2020
+ # Projects not compatible with jdk11 can set java-version to something else
+ sonarcloud-java-version: openjdk11
stream: master
submodule-recursive: true
submodule-timeout: 10
# yamllint disable-line rule:line-length
sonarcloud-project-organization: "{sonarcloud-project-organization}"
sonarcloud-api-token: "{sonarcloud-api-token}"
+ sonarcloud-java-version: "{sonarcloud-java-version}"
# With SonarQube
- conditional-step:
condition-kind: not
--- /dev/null
+---
+fixes:
+ - |
+ Run Sonar scans using JDK11.
+ *java-version* will only set java for the maven build part of the job,
+ the sonar scan will use *sonarcloud-java-version* which is set to *openjdk11*.
+ Projects not compatible with JDK11 will be able to run their build with
+ *java-version* set to their JDK preference.
+ https://sonarcloud.io/documentation/user-guide/move-analysis-java-11/
params+=("-Dsonar.login=$API_TOKEN")
fi
+if [ "$SET_JDK_VERSION" != "$SONARCLOUD_JAVA_VERSION" ]; then
+ export SET_JDK_VERSION="$SONARCLOUD_JAVA_VERSION"
+ bash <(curl -s https://raw.githubusercontent.com/lfit/releng-global-jjb/master/shell/update-java-alternatives.sh)
+ source /tmp/java.env
+fi
+
# Disable SC2086 because we want to allow word splitting for $MAVEN_* parameters.
# shellcheck disable=SC2086
"$MVN" $SONAR_MAVEN_GOAL \