Maven - Java version changes automatically to 1.5 after maven update
Maven - Java version changes automatically to 1.5 after maven update
In my maven project whenever i update the project, my project would default to J2SE-1.5 execution environment. To overcome this issue add the following properties in the POM.xml
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Where 1.8 is the java version of your current JDK/JRE. Another way of doing this is adding a with the maven-compile-plugin as
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version> <!-- or whatever current version -->
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Comments
Post a Comment