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

Popular posts from this blog

Using Android Key Events via ADB adb shell input keyevent

Docker - Failed to solve with frontend dockerfile.v0: failed to read dockerfile: error from sender: open .Trash: operation not permitted - solution security and privacy

Mobile Application Test Automation Strategy