In my pom.xml I declared the Maven compiler plugin as followed:
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
But m2e does not update the JRE that is used for this project. It still uses Java 1.4. Installed is the JDK 8 update 5. This is the only version that is installed. I am on windows.
Did I miss something? On my Mac I have the same settings and there it works.
Update
I set up a new virtual Windows machine on my Mac and did clean installs of Java 8, Eclipse Kepler SR2 and Maven. Now Maven sets the correct JRE, but Eclipse gives me errors like "Syntax error, X is only available if source level is 1.5 or greater". Project specific settings for the compiler are enabled by m2e and set to 1.7. I also bumped the compiler plugin version to 3.1. I am totally confused. Please help me!
You need to install Java 8 support for Eclipse and Maven via the Eclipse marketplace:
Help > Eclipse Marketplace > Search for "java 8"
Then install the following two plugins:
Java 8 support for Eclipse Kepler SR2
Java 8 support for m2e for Eclipse Kepler SR2
You need to restart Eclipse during the installation.
Related
We are using the Tomee Maven Plugin for starting a Tomcat server and running some webapps. We need to use a specific version of Java, which is installed on the local system. Yet the Plugin picks the wrong Java version for starting Tomcat. We then get illegal argument exceptions due to the wrong Java version being used. How can we configure the Tomee Maven plugin to use a specific Java version?
Looking at the documentation there does not seem to be anyway to specify Java Version.
However each version of Tomee supports specific versions of Java, for example Java8/11, etc.
You could select the version that is suitable for your JDK version, as well ensure that your pom.xml has source/target for the specific java version you want:
<properties>
<tomee.version>7.0.2</tomee.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
You could also ensure that your maven compiler plugin uses the appropriate JDK:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
I migrated my application to OpenJDK11 and Jenkins build is failing because Findbug is no longer supported.
The plugin :
sonar-maven-plugin - Is internally calling Findbug in java 11 env and it's breaking
the Jenkins build
How do I migrate this plugin to use the latest Spotbug dependency, I still want to keep the sonar-maven-plugin to get the report to sonar.
Current pom.xml relevant portion :
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.7.0.1746</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Already went through many docs. Couldn't find a solution.
SonarQube version: Version 6.7 (build 33306)
Installed Plugins (Relevant ones) :
FindbugsExternal Analysers Analyze Java code with SpotBugs 3.1.0-RC6.
3.6.0
SonarJavaLanguages Code Analyzer for Java
5.13.1 (build 18282)
SonarXML Code Analyzer for XML
2.0.1 (build 2020)
CheckstyleExternal Analysers Analyze Java code with Checkstyle
4.23
FindbugsExternal Analysers Analyze Java code with SpotBugs 3.1.0-RC6. 3.6.0
I cannot find version of the SonarQube Findbugs plugin which provides SpotBugs 3.1.0-RC6. It should be between:
3.7.0 (released: 15 Mar 2018) provides SpotBugs 3.1.2 (see code)
3.6.0 (released: 21 Sep 2017) provides SpotBugs 3.1.0-RC5 (see code)
It seems to me that you use a custom version of the plugin.
First version of the Findbugs plugin which promise to support JDK 11 is 3.10.0 (depends on SonarJava 5.10.1, where JDK 11 is supported since SonarJava 5.8 (SONARJAVA-2862), see code).
Second problem is that you try to use an not maintained (unsupported) version of server:
SonarQube version: Version 6.7 (build 33306)
with the latest version of SonarScanner:
<artifactId>sonar-maven-plugin</artifactId>
<version>3.7.0.1746</version>
SonarQube 6.7 has been released on 8 Nov 2017 (tag has been created at 7 Nov 2017). It has been released before the first official JDK 11 LTS release (Google shows September 2018).
I think the only correct solution is to upgrade SonarQube to at least 7.9 LTS with all plugins.
Try downgrading the sonar plugin version. This plugin version worked for me.
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
I have a maven project using java 10 and I want to edit it in eclipse photon. It more or less works ok, but I do get the warning:
Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.
Setting the java compiler --> JDK compliance level to 10 in the project properties in eclipse doesn't remove this warning.
Is this an issue with the maven-compiler-plugin? I am currently using version 3.7.0 configured like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>10</source>
<target>10</target>
<release>10</release>
<encoding>UTF-8</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.2</version> <!-- Use newer version of ASM -->
</dependency>
</dependencies>
</plugin>
Tips on how to configure a maven project using java 10 and eclipse photon would be greatly appreciated.
The issue seems to be with the JRE specified on the build path of your project. Right-click on the project and then go to Properties > Java Build Path > Libraries. There, edit the JRE System Library specified to JRE 10.
Actually, my problem was related to the version of Spring Tool Suite I was using. It turns out that I had upgraded my environment using the update site instead of downloading the new version. I was using Spring Tool Suite 4.7.3a instead of 4.8.0. Using 4.8.0 resolved the issue.
I previously i installed JRE 8. I uninstalled it and installed JRE 7 because Jasper ireport is incompatible with JRE 8. After I installed JRE 7, my current maven project has been stopped working.
Another problems appeared that appeared is "project configuration is not up to date with pom xml". I found this answer. I tried all that but nothing happened.
If you need more details, please let me know.
add the following configuration :
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<skip>true</skip>
</configuration>
</plugin>
And right-click on your project: Maven->Update Maven Project
I've created a project in eclipse and added maven dependencies. In Eclipse, it says that I am using JRE 1.5. Everything works fine in Eclipse, for instance, I can run my tests.
When I try to run mvn clean install from the terminal, it gives me the following error.
...generics are not supported in -source 1.3 (use -source 5 or higher to enable generics)...
Its seems that Maven thinks I'm using JRE 1.3 and cannot recognize generics or for-each loops.
How can I:
Validate my assumption that maven is using the wrong version.
Get Maven to compile my project.
Specify the correct version of your JRE in the Maven compiler plugin, by default your pom.xml file will inherit the compiler-plugin from the Maven super pom.xml which targets the 1.3 JRE.
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>