Hi, i want ask a question about new sonarcloud analyzer. I will tell my Environemnt
- Sonarcloud
- CI/CD Tools: Azure Pipelines
- Build: Maven Task
My pipeline:
- task: Bash@3
displayName: 'Use JDK11 by default'
inputs:
targetType: 'inline'
script: |
echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME_11_X64"
- task: Maven@3
displayName: Maven Build
inputs:
mavenPomFile: '$(Agent.BuildDirectory)/code/pom.xml'
goals: '-s $(Agent.BuildDirectory)/tool/tool/settings.xml -Dmaven.test.skip=true package'
options: '$(MAVEN_OPTS)'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: true
effectivePomSkip: false
sonarQubeRunAnalysis: true
My application build use Java 8, but sonarcloud analyzer must running in Java 11. I have try any suggestin like to change the default JDK to JDK 11, but still showing failed message like below
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project delivery-parent: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar: java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
If i change the maven task with sonarQubeRunAnalysis: true and use sonarcloud Analyze task, the output show warning message like this
##[warning][SQ] When using Maven or Gradle, don't use the analyze task but instead tick the 'SonarQube' option in the Maven/Gradle task to run the scanner as part of the build.
Please give me a suggestion