4

In intelij maven compiling in Java SDK 1.8 but showing automatically changes to Java SDK 1.5 and shows this error

1 Answers1

5

On your pom.xml file should have this, it specified the maven compiler to 1.8

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Or

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
</plugin>
Dang Nguyen
  • 1,209
  • 1
  • 17
  • 29