Sonar Maven Plugin Fails on Jenkins Slave with Java 8 Compatibility Issue

Hello,

I am encountering an issue when running a Jenkins pipeline that involves SonarQube (9.9) analysis. The job is failing on a Jenkins slave machine that runs Java 8. Below is the error message:

vbnet

Copy code

[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

The error indicates that the Sonar Maven plugin requires Java 11 (class file version 55.0), but the Jenkins slave is running Java 8, which only supports class file versions up to 52.0.

I am hesitant to upgrade the entire Jenkins slave to Java 11 because it may introduce compatibility issues with other Maven builds that are dependent on Java 8.

My sonarqube 9.9 run in a separate instance in java 17

Additionally, I have another Jenkins slave with both Java 8 and Java 11 installed. Is there a way to configure my Jenkins pipeline or Maven job to dynamically select the appropriate Java version based on the tool (e.g., Java 11 for SonarQube analysis and Java 8 for other parts of the build)?

I would appreciate any advice on how to resolve this issue without disrupting the current setup.

Thanks in advance!

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

i tried in java 8 and java 11 present in same jenkins slave facing same error

Hi,

It’s been a very long time since I wrangled Jenkins configuration. What I can tell you is that users have historically had a hard time getting the code compiled with a lower version of Java and then analyzed with a higher version.

The good news is that you can always compile down to an earlier version of Java using a newer version of Java. You just need to set the target version.

 
HTH,
Ann

Hi @ganncamp,

Thanks for replying

Problem is SonarQube does n’t analysis the code in java 8 slave.
Explain me in which slave i use the Maven plugin correction Slave 1: java 8 slave or Slave 2: java 11 and 8 in same slave. which one i choose.

Regards,
Martin

Hi Martin,

I would use the slave that analysis will run on: the one with Java 11.

 
HTH,
Ann

Hi @ganncamp,

Thanks for your reply.

My Jenkins slaves are running in separate AWS instance in docker container i have 2 slaves one is Java 8 agent for java 8 project pipeline only install Java 8 version another one is Java 11 default and also java 8 is installed in that same agent total 2 slaves. So the think is i try to run the java 8 Jenkins pipeline for java 8 project built it failed because of SonarQube 9.9 plugins does n’t run in java 8 agent SonarQube need at least java 11 so my question is that possible to run the same pipeline groovy script. can we configure java 8 for maven build and other think java 11 for only SonarQube 9.9 after complete the SonarQube analysis again return continue on java 8 is that Possiable or Not.

Regard,
Martin

Hi Martin,

You can use any newer version of Java to compile down to any older version of Java. You can use Java 11, or even Java 17 to produce your Java 8 artifacts. You just need to set the target.

That means you can use your Java 11 build agent for everything.

That’s a question of what’s possible in your pipeline. I’ve seen people using Jenkins have trouble varying JVMs in the same job, but that’s been a while ago now. Maybe things have changed.

 
HTH,
Ann