PMD maven plugin not working for jdk 1.7 - maven

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?

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.

How to fix sonar plugin issue in jenkins

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

which version of sonarqube gradle plugin compatible with jdk 7?

I am trying to integrate sonarqube gradle plugin with jdk7 but build is failing due to version mismatch.
Gralde version 4.3
JDK 1.7
Sonarqube-gradle plugin ??
2.0.1 was the last version to support Java 7
https://github.com/SonarSource/sonar-scanner-gradle/releases/tag/2.0.1
https://github.com/SonarSource/sonar-scanner-gradle/blob/2.0.1/build.gradle#L24..L25

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.

Maven UnsupportedClassVersionError Unsupported major.minor version 51.0

So I recently installed maven using homebrew. Seemed to be working fine. I got this error. I tried uninstalling then reinstalling maven. Now I can't even type mvn --version without getting this error.
I've double checked using
javac -version
and java -version.
I'm using 1.8.0_51.
That isn't the problem.
Any ideas?
Maven doesn't use the javac on the path, but is uses the JAVA_HOME. Execute mvn -v to see which Java version is actually used by Maven.

Resources