I am facing an issue where my Jenkins pipeline fails during the SonarQube (version 9.9) analysis. The pipeline runs on a Jenkins agent machine with Java 8, but the SonarQube plugin requires Java 11, which is causing the job to fail with the following error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar (default-cli) on project MyProject:
Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar failed:
Unable to load the mojo 'sonar' in the plugin 'org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121' due to an API incompatibility:
org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/sonarsource/scanner/maven/SonarQubeMojo 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
Setup:
- Jenkins Version: 2.x
- SonarQube Version: 9.9 (running on Java 17)
- Jenkins agent: Running Java 8
What I’ve Tried:
- Alternative agent with Java 8 and Java 11 Installed: I also tried running the job on another Jenkins agent that has both Java 8 and Java 11 installed (Java 11 being the default). However, I faced the same issue when attempting to run the SonarQube analysis on that agent.
Here is part of the log from the failing pipeline:
14:13:19 [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:Maven-surefire-plugin:2.19.1: Plugin org.apache.maven.plugins:Maven-surefire-plugin:2.19.1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:Maven-surefire-plugin:jar:2.19.1 in https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/ was cached in the local repository, resolution will not be reattempted until the update interval of BFDL_PROXY has elapsed or updates are forced
14:13:19 [INFO]
14:13:19 [INFO] --- sonar-maven-plugin:4.0.0.4121:sonar (default-cli) @ BillDeskIntegrationService ---
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.pom
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.pom (3 KB at 160.6 KB/sec)
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonarsource/scanner/api/sonar-scanner-api/2.16.3.1081/sonar-scanner-api-2.16.3.1081.pom
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonarsource/scanner/api/sonar-scanner-api/2.16.3.1081/sonar-scanner-api-2.16.3.1081.pom (6 KB at 280.2 KB/sec)
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonarsource/scanner/api/sonar-scanner-api-parent/2.16.3.1081/sonar-scanner-api-parent-2.16.3.1081.pom
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonarsource/scanner/api/sonar-scanner-api-parent/2.16.3.1081/sonar-scanner-api-parent-2.16.3.1081.pom (5 KB at 236.5 KB/sec)
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonarsource/parent/parent/60.0.52/parent-60.0.52.pom
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonarsource/parent/parent/60.0.52/parent-60.0.52.pom (32 KB at 1485.0 KB/sec)
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/commons-lang/commons-lang/2.6/commons-lang-2.6.pom
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/commons-lang/commons-lang/2.6/commons-lang-2.6.pom (18 KB at 1423.7 KB/sec)
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/apache/commons/commons-parent/17/commons-parent-17.pom
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/apache/commons/commons-parent/17/commons-parent-17.pom (31 KB at 1791.4 KB/sec)
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.jar
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonarsource/scanner/api/sonar-scanner-api/2.16.3.1081/sonar-scanner-api-2.16.3.1081.jar
14:13:19 [INFO] Downloading: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar (28 KB at 614.9 KB/sec)
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/commons-lang/commons-lang/2.6/commons-lang-2.6.jar (278 KB at 3558.4 KB/sec)
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.jar (246 KB at 2583.0 KB/sec)
14:13:19 [INFO] Downloaded: https://artifactory.bfsgodirect.com/repository/BFDL_PROXY/org/sonarsource/scanner/api/sonar-scanner-api/2.16.3.1081/sonar-scanner-api-2.16.3.1081.jar (611 KB at 5602.7 KB/sec)
14:13:19 [WARNING] Error injecting: org.sonarsource.scanner.maven.SonarQubeMojo
14:13:19 java.lang.TypeNotPresentException: Type org.sonarsource.scanner.maven.SonarQubeMojo not present
14:13:19 at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:147)
14:13:19 at org.eclipse.sisu.space.NamedClass.load(NamedClass.java:46)
14:13:19 at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
14:13:19 at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
14:13:19 at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
14:13:19 at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
14:13:19 at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
14:13:19 at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
14:13:19 at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
14:13:19 at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
14:13:19 at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
14:13:19 at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
14:13:19 at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
14:13:19 at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
14:13:19 at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
14:13:19 at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
14:13:19 at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
14:13:19 at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
14:13:19 at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
14:13:19 at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
14:13:19 at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:517)
14:13:19 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
14:13:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
14:13:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
14:13:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
14:13:19 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
14:13:19 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
14:13:19 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
14:13:19 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
14:13:19 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
14:13:19 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
14:13:19 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
14:13:19 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
14:13:19 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
14:13:19 at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
14:13:19 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:13:19 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
14:13:19 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
14:13:19 at java.lang.reflect.Method.invoke(Method.java:498)
14:13:19 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
14:13:19 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
14:13:19 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
14:13:19 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
14:13:19 Caused by: java.lang.UnsupportedClassVersionError: org/sonarsource/scanner/maven/SonarQubeMojo 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
14:13:19 at java.lang.ClassLoader.defineClass1(Native Method)
14:13:19 at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
14:13:19 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
14:13:19 at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
14:13:19 at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
14:13:19 at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
14:13:19 at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
14:13:19 at java.security.AccessController.doPrivileged(Native Method)
14:13:19 at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
14:13:19 at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
14:13:19 at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
14:13:19 at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
14:13:19 at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
14:13:19 at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
14:13:19 at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:139)
14:13:19 ... 42 more
14:13:19 [INFO] ------------------------------------------------------------------------
14:13:19 [INFO] BUILD FAILURE
14:13:19 [INFO] ------------------------------------------------------------------------
14:13:19 [INFO] Total time: 43.816 s
14:13:19 [INFO] Finished at: 2024-09-24T08:44:18+00:00
14:13:20 [INFO] Final Memory: 78M/1122M
14:13:20 [INFO] ------------------------------------------------------------------------
14:13:20 [WARNING] The requested profile "qa" could not be activated because it does not exist.
14:13:20 [INFO] [jenkins-event-spy] Generated /home/jenkins/workspace/copy-Pipeline-V1-billdeskintegrationservice@tmp/withMaven59dd3f88/maven-spy-20240924-084334-7342571139178830917017.log
14:13:20 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar (default-cli) on project BillDeskIntegrationService: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar failed: Unable to load the mojo 'sonar' in the plugin 'org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/sonarsource/scanner/maven/SonarQubeMojo 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
14:13:20 [ERROR] -----------------------------------------------------
14:13:20 [ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:4.0.0.4121
14:13:20 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
14:13:20 [ERROR] urls[0] = file:/root/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/4.0.0.4121/sonar-maven-plugin-4.0.0.4121.jar
14:13:20 [ERROR] urls[1] = file:/root/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
14:13:20 [ERROR] urls[2] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.jar
14:13:20 [ERROR] urls[3] = file:/root/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
14:13:20 [ERROR] urls[4] = file:/root/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.3.1081/sonar-scanner-api-2.16.3.1081.jar
14:13:20 [ERROR] urls[5] = file:/root/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
14:13:20 [ERROR] Number of foreign imports: 1
14:13:20 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
14:13:20 [ERROR]
14:13:20 [ERROR] -----------------------------------------------------
14:13:20 [ERROR] -> [Help 1]
14:13:20 [ERROR]
14:13:20 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
14:13:20 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
14:13:20 [ERROR]
14:13:20 [ERROR] For more information about the errors and possible solutions, please read the following articles:
14:13:20 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
14:13:20 [Pipeline] }
14:13:20 WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeeded?
14:13:20 [Pipeline] // withSonarQubeEnv
14:13:20 [Pipeline] }
14:13:20 [withMaven] artifactsPublisher - Archive artifact BillDeskIntegrationService/pom.xml under BillDeskIntegrationService/BillDeskIntegrationService/1.0.22/BillDeskIntegrationService-1.0.22.pom
14:13:20 [withMaven] artifactsPublisher - Archive artifact BillDeskIntegrationService/target/BillDeskIntegrationService-1.0.22.jar under BillDeskIntegrationService/BillDeskIntegrationService/1.0.22/BillDeskIntegrationService-1.0.22.jar
14:13:33 [withMaven] junitPublisher - Archive test results for Maven artifact BillDeskIntegrationService:BillDeskIntegrationService:jar:1.0.22 generated by maven-surefire-plugin:test (default-test): BillDeskIntegrationService/target/surefire-reports/*.xml
14:13:33 [withMaven] junitPublisher - Jenkins JUnit Attachments Plugin not found, can't publish test attachments.Recording test results
14:13:34 [withMaven] jacocoPublisher - Archive JaCoCo analysis results for Maven artifact MavenArtifact{BillDeskIntegrationService:BillDeskIntegrationService:jar:1.0.22(version: 1.0.22, snapshot:false) } generated by PluginInvocation{org.jacoco:jacoco-maven-plugin:0.7.9@prepare-agent jacoco-initialize}: execFile: BillDeskIntegrationService/target/jacoco-ut.exec, sources: BillDeskIntegrationService/src/main/java, classes: BillDeskIntegrationService/target/classes
14:13:34 [JaCoCo plugin] Collecting JaCoCo coverage data...
14:13:34 [JaCoCo plugin] BillDeskIntegrationService/target/jacoco-ut.exec;BillDeskIntegrationService/target/classes;BillDeskIntegrationService/src/main/java; locations are configured
14:13:34 [JaCoCo plugin] Number of found exec files for pattern BillDeskIntegrationService/target/jacoco-ut.exec: 1
14:13:34 [JaCoCo plugin] Saving matched execfiles: /home/jenkins/workspace/copy-Pipeline-V1-billdeskintegrationservice/BillDeskIntegrationService/target/jacoco-ut.exec
14:13:34 [JaCoCo plugin] Saving matched class directories for class-pattern: BillDeskIntegrationService/target/classes:
14:13:34 [JaCoCo plugin] - /home/jenkins/workspace/copy-Pipeline-V1-billdeskintegrationservice/BillDeskIntegrationService/target/classes 129 files
14:13:34 [JaCoCo plugin] Saving matched source directories for source-pattern: BillDeskIntegrationService/src/main/java:
14:13:34 [JaCoCo plugin] Source Inclusions: **/*.java,**/*.groovy,**/*.kt,**/*.kts
14:13:34 [JaCoCo plugin] Source Exclusions:
14:13:34 [JaCoCo plugin] - /home/jenkins/workspace/copy-Pipeline-V1-billdeskintegrationservice/BillDeskIntegrationService/src/main/java 125 files
14:13:34 [JaCoCo plugin] Loading inclusions files..
14:13:34 [JaCoCo plugin] inclusions: []
14:13:34 [JaCoCo plugin] exclusions: []
14:13:36 [JaCoCo plugin] Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]
14:13:36 [JaCoCo plugin] Publishing the results..
14:13:36 [JaCoCo plugin] Loading packages..
14:13:36 [JaCoCo plugin] Done.
14:13:36 [JaCoCo plugin] Overall coverage: class: 97, method: 96, line: 85, branch: 46, instruction: 84, complexity: 83
14:13:36 [withMaven] Jenkins Task Scanner Plugin not found, don't display results of source code scanning for 'TODO' and 'FIXME' in pipeline screen.
14:13:36 [withMaven] Publishers: Pipeline Graph Publisher: 1 ms, Generated Artifacts Publisher: 13108 ms, Junit Publisher: 627 ms, Dependencies Fingerprint Publisher: 159 ms, Jacoco Publisher: 2029 ms, Open Task Scanner Publisher: 1 ms
14:13:36 [withMaven] artifactsPublisher - Archive artifact BillDeskIntegrationService/pom.xml under BillDeskIntegrationService/BillDeskIntegrationService/1.0.22/BillDeskIntegrationService-1.0.22.pom
14:13:36 [withMaven] artifactsPublisher - Archive artifact BillDeskIntegrationService/target/BillDeskIntegrationService-1.0.22.jar under BillDeskIntegrationService/BillDeskIntegrationService/1.0.22/BillDeskIntegrationService-1.0.22.jar
14:13:52 [withMaven] junitPublisher - Archive test results for Maven artifact BillDeskIntegrationService:BillDeskIntegrationService:jar:1.0.22 generated by maven-surefire-plugin:test (default-test): BillDeskIntegrationService/target/surefire-reports/*.xml
14:13:52 [withMaven] junitPublisher - Jenkins JUnit Attachments Plugin not found, can't publish test attachments.Recording test results
14:13:52 [withMaven] jacocoPublisher - Archive JaCoCo analysis results for Maven artifact MavenArtifact{BillDeskIntegrationService:BillDeskIntegrationService:jar:1.0.22(version: 1.0.22, snapshot:false) } generated by PluginInvocation{org.jacoco:jacoco-maven-plugin:0.7.9@prepare-agent jacoco-initialize}: execFile: BillDeskIntegrationService/target/jacoco-ut.exec, sources: BillDeskIntegrationService/src/main/java, classes: BillDeskIntegrationService/target/classes
14:13:52 [JaCoCo plugin] Collecting JaCoCo coverage data...
14:13:52 [JaCoCo plugin] BillDeskIntegrationService/target/jacoco-ut.exec;BillDeskIntegrationService/target/classes;BillDeskIntegrationService/src/main/java; locations are configured
14:13:52 [JaCoCo plugin] Number of found exec files for pattern BillDeskIntegrationService/target/jacoco-ut.exec: 1
14:13:52 [JaCoCo plugin] Saving matched execfiles: /home/jenkins/workspace/copy-Pipeline-V1-billdeskintegrationservice/BillDeskIntegrationService/target/jacoco-ut.exec
14:13:53 [JaCoCo plugin] Saving matched class directories for class-pattern: BillDeskIntegrationService/target/classes:
14:13:53 [JaCoCo plugin] - /home/jenkins/workspace/copy-Pipeline-V1-billdeskintegrationservice/BillDeskIntegrationService/target/classes 129 files
14:13:53 [JaCoCo plugin] Saving matched source directories for source-pattern: BillDeskIntegrationService/src/main/java:
14:13:53 [JaCoCo plugin] Source Inclusions: **/*.java,**/*.groovy,**/*.kt,**/*.kts
14:13:53 [JaCoCo plugin] Source Exclusions:
14:13:53 [JaCoCo plugin] - /home/jenkins/workspace/copy-Pipeline-V1-billdeskintegrationservice/BillDeskIntegrationService/src/main/java 125 files
14:13:53 [JaCoCo plugin] Loading inclusions files..
14:13:53 [JaCoCo plugin] inclusions: []
14:13:53 [JaCoCo plugin] exclusions: []
14:13:53 [JaCoCo plugin] Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]
14:13:53 [JaCoCo plugin] Publishing the results..
14:13:55 [JaCoCo plugin] Loading packages..
14:13:55 [JaCoCo plugin] Done.
14:13:55 [JaCoCo plugin] Overall coverage: class: 97, method: 96, line: 85, branch: 46, instruction: 84, complexity: 83
14:13:55 [withMaven] Jenkins Task Scanner Plugin not found, don't display results of source code scanning for 'TODO' and 'FIXME' in pipeline screen.
14:13:55 [withMaven] Publishers: Pipeline Graph Publisher: 3 ms, Generated Artifacts Publisher: 15834 ms, Junit Publisher: 201 ms, Dependencies Fingerprint Publisher: 196 ms, JGiven Publisher: 1 ms, Jacoco Publisher: 2282 ms, Open Task Scanner Publisher: 1 ms
14:13:55 [Pipeline] // withMaven
14:13:55 [Pipeline] }
14:13:55 [Pipeline] // script
14:13:55 [Pipeline] }
14:13:55 [Pipeline] // stage
14:13:55 [Pipeline] stage
14:13:55 [Pipeline] { (Git Tagging)
14:13:55 Stage "Git Tagging" skipped due to earlier failure(s)
14:13:55 [Pipeline] }
14:13:55 [Pipeline] // stage
14:13:55 [Pipeline] stage
14:13:55 [Pipeline] { (Add New Relic)
14:13:55 Stage "Add New Relic" skipped due to earlier failure(s)
14:13:55 [Pipeline] }
14:13:55 [Pipeline] // stage
14:13:55 [Pipeline] stage
14:13:55 [Pipeline] { (Build and Deploy Docker Image to AWS ECR)
14:13:55 Stage "Build and Deploy Docker Image to AWS ECR" skipped due to earlier failure(s)
14:13:55 [Pipeline] }
14:13:55 [Pipeline] // stage
14:13:55 [Pipeline] }
14:13:55 [Pipeline] // withEnv
14:13:55 [Pipeline] }
14:13:55 [Pipeline] // node
14:13:55 [Pipeline] End of Pipeline
14:13:55 ERROR: script returned exit code 1
14:13:55 Finished: FAILURE
Questions:
- Is there a way to dynamically switch Java versions in a Jenkins pipeline so that I can use Java 8 for regular builds but Java 11 for SonarQube analysis, without causing compatibility issues with other jobs that depend on Java 8?
- What are the best practices to configure a Jenkins setup that requires different Java versions for specific tools like SonarQube?
- Has anyone encountered similar issues where SonarQube requires Java 11, but the Jenkins agent defaults to Java 8? How did you manage to resolve it?
Additional Context:
- SonarQube: Runs on a separate instance with Java 17.
- Jenkins agent: Java 8, with another agent available that has both Java 8 and Java 11 installed(Default is java 11).
- Sonar Maven Plugin: 4.0.0.4121
Any insights or suggestions would be greatly appreciated. Thanks!