Idea create Maven project Error: [error] no longer supports source option 1.5. Please use version 1.6 or higher, and the idea reports an error: error: Java does not support the error of release version 5

Project scenario:

As soon as the Maven project changes the POM file, the language level automatically becomes 5

Problem Description:

question 1: the Tomcat plug-in under move starts with an error
[error] the source option 1.5 is no longer supported. Please use version 1.6 or later
[error] target option 1.5 is no longer supported. Please use version 1.6 or later
idea error: error: Java does not support release version 5. This error


Cause analysis:

Maven is a project management tool. If you don’t tell it what JDK version to use for code compilation, it will be handled with the default JDK version of the compilation plug-in Maven compi ler plugin, which is prone to version mismatch, which may lead to failure of compilation


Solution:

to avoid this situation, the first step when building a maven project is to configure the Maven compiler plugin in the project POM XML file specifies the JDK version of the project source code, the compiled JDK version, and the encoding method

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <source>9</source>
          <target>9</target>
          <encoding>utf-8</encoding>
        </configuration>
      </plugin>


Read More: