Objective: We are trying to switch to using Java 11 from Java 8. But the Jenkins pipeline fails to build.
sonarqube ver 3.0
Steps:
Run the gradlew build
before running the gradlew sonarqube
This is the command we are running:
CI=true ./gradlew sonarqube -Dsonar.login=${SONAR_LOGIN} -Dsonar.host.url=${SONAR_URL} -x test -x compileJava -x compileTestJava -x compileScala -x compileTestScala -x compileKotlin -x compileTestKotlin -Dsonar.pullrequest.key=xx -Dsonar.pullrequest.branch=pr-new -Dsonar.pullrequest.base=master -Dsonar.pullrequest.provider=GitHub
When running this command, we see the error in the log:
==============================
* What went wrong:
Execution failed for task ':sonarqube'.
> Could not resolve all files for configuration ':condor:compileClasspath'.
> Could not resolve project :segment_db.
Required by:
project :condor
> Unable to find a matching variant of project :test_db:
- Variant 'apiElements' capability com.test_db:1.0-SNAPSHOT:
- Incompatible attribute:
- Required org.gradle.jvm.version '8' and found incompatible value '11'.
- Other attributes:
- Found org.gradle.category 'library' but wasn't required.
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api-jars'.
- Required org.jetbrains.kotlin.platform.type 'jvm' but no value provided.
==============================
Problem: If we are skipping the test, compile etc, shouldn’t it not throw this error:
Could not resolve all files for configuration ‘:condor:compileClasspath’.
The temporary fix is: we added
-Dsonar.scanner.force-deprecated-java-version-grace-period=true this to the above command and the build passes. However, once you deprecate support for Java 8, will this still work?
Please let me know if there is a workaround for this.
Any help will be greatly appreciated.