Reason: it is mainly because the JDK version is inconsistent
1. The compiled version does not match. 2. The current project JDK version does not support
1. First, view the JDK of the project
File -> Project Structure-> Project Settings -> Project
1.8 must correspond to 8
Check whether the JDK of the current project (module) is the same as that of the project
2. Maven is used in the idea to build the project. The target bytecode version is automatically changed to 1.5 Because no JDK is specified in maven, it will be scanned as the default JDK version View and set the java compiler version (target bytecode version)
File–> Setting–> Build,Execution,Deployment–>Compiler
–> Java compiler sets the corresponding module
The appropriate version of target bytecode version, such as JDK1.8 Change 1.5 above to 1.8
Solution:
Add Maven compiler plugin to pom.xml so that it will not automatically become 1.5
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
Read More:
- How to select the jar package version for Maven package when the jar package versions referenced by multiple modules are inconsistent
- Error resolving version for plugin ‘org.apache.maven.plugins:maven-compiler-plugin’ from the repo…
- Solve the problem that target code version of Maven project sub module in IntelliJ idea is always rolled back
- appear Error:java : javacTask: source release 1.7 requires target release 1.7
- javac Task Error source release 1.7 requires target release
- Maven invalid source release 11
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Hello
- The import Maven project appears http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Solutions
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile)
- An error is reported when executing MVN. The diamond operator is not supported in source-1.5
- Maven compilation error: package does not exist jar package does not exist
- How to Solve Error: Failed to execute goal org.codehaus.mojo:……..
- Idea error: error: Java: error: release 5 is not supported
- Solutions to error: Java: compilation failed: internal java compiler error
- Update project manually_ Solution of too large jar package in springboot
- Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build Exception caught: basedir src/mai
- Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0
- Idea error: Java: compilation failed: internal java compiler error
- IntelliJ idea error: error: Java does not support release 5
- Failed to execute goal