How to fix sonar plugin issue in jenkins - maven

How to avoid issue with sonar scanner plugin on Jenkins 2.289.2, plugin sonar 2.13.1
when compiling a project I got the error
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project maven-project:
Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar failed:
An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155: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
It looks like an issue with the version of java but I would like to avoid changing my java version

Probably the compiled code you trying to run was compiled using java 11, but in env installed only java 8.
Try to install java 11 and make sure to update OS environment settings to point to the new JDK.
Java Details:
Java 8 uses major version 52
Java 11 uses major version 55

Related

RunMojo compatibility problem with camel plugin

I have installed Camel plugin for IntelliJ.
To start debugging, we must create an ad-hoc application
The problem is that it gives me that error running it, when building the war file
org/apache/camel/maven/RunMojo 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
I can't just find where the problem is. I have checked all the java versions defined everywhere and seems fine...
in the POM
so what can be the problem? Mojo version is
The plugin has been compiled with JDK 11 and requires the minimum JDK version 11 to work with.

Unable to start derby network server

I am in the derby bin folder. Executed the . setNetworkServerCP command. Now when I try to use command startNetworkServer it shows command not found.
I also tried to execute the java command as follows:
java -jar lib/derbynet.jar start
However, I am getting this error:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/apache/derby/drda/NetworkServerControl has been compiled by a
more recent version of the Java Runtime (class file version 53.0),
this version of the Java Runtime only recognizes class file versions up to 52.0
Please help me. I am using Ubuntu 16.04
Derby version 10.15 supports Java version 9 and higher.
Derby version 10.14 supports Java version 8.
Since java version 9 is classfile version 53, it seems that you are trying to run Derby 10.15 using Java version 8.
So either switch to Derby 10.14, or move to Java 9+.

Gradle in the mac's idea, build sync failed

Created a gradle project with idea2017 for mac, when refresh all gradel projects, build:sync failed
java version: 1.8.0
gradle version: 4.4
Error: Could not find or load main class .Library.Java.JavaVirtualMachines.jdk1.8.0_152.jdk.Contents.Home
How can I build it?
Thanks.
I have already set JAVA_HOME

PMD maven plugin not working for jdk 1.7

When I run mvn pmd:check with JAVA_HOME set to jdk 1.8, this runs smoothly. When I switch the jdk to 1.7 I get following exception.
PMD support 1.7, so not sure why I am getting this error.
Caused by: org.apache.maven.plugin.PluginContainerException: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-pmd-plugin:3.8:pmd: java.lang.UnsupportedClassVersionError: : Unsupported major.minor version 52.0
Anybody faced the same issue?
52.0 is Java 8. This meant that I was somehow trying to run Java 8 code in a Java 7 VM. Eventhough my jdk and JAVA_HOME was set to 7.
The pmd plugin I was using was version 3.8 , which seems to support jdk 8+.
I downgraded my maven-pmd-plugin to 3.7. And the exception went away.
That's weird. PMD is still working with JDK7 - as is maven. JDK8 is only required, if you want to analyze Salesforce.com Apex code.
Would you mind running mvn with the -e or -X option, to see which class is for java8? You should get a stacktrace then. It might be caused by a dependency.
Also: Which version of maven are you using?

Sonarqube 4.5.1 compatibility with jdk 6

I am running a build with sonarqube 4.5.1 and JDK 6. I am getting this following error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project test-util: The plugin java is not supported with Java 1.6.0_26: org/sonar/plugins/java/JavaPlugin : Unsupported major.minor version 51.0
I found one document on internet which says that JDK 6 is no longer supported to run SonarQube starting from 4.5.1.
Could anyone please confirm , if this error message is because JDK 6 is no longer supported with sonarqube 4.5.1?
Thanks in advance.
Yes, you need JDK 7 or later (see How to fix: Unsupported major.minor version 51.0 error?).
You can still build your project with JDK 6, but SonarQube analysis should be executed by JDK 7 or later.
You can run Sonar 4.5.1 version with jdk1.6 , provided you give a sonar-maven-plugin jar which is compatible with java6.
sonar-maven-plugin version 2.4 is not compatible with java 6 and it works with java 7.
We are also doing the same, compiling the project with Java 6 and running sonar analysis with Java 7.
Can anyone provide the sonar-maven-plugin version < 2.4 which is compatible with java 6.
As of now i am trying with sonar-maven-plugin 2.3.1 but don't know whether it will work, will update the result soon.

Resources