In the project, use gradle to build the project. When we want to change the version of the JDK, the following error is reported:
Information:Using javac 1.8.0_111 to compile java sources
Information:java: javacTask: source release 1.8 requires target release 1.8
Information:java: Errors occurred while compiling module’Spring_1_main’
Information:2018/1/4 18:46-Compilation completed with 1 error and 0 warnings in 3s 768ms
Error:java: Compilation failed: internal java compiler error
In fact, there are a few things that need to be changed:
1. Change the build.gradle file
sourceCompatibility = 1.8
2. Change the .idea/compiler.xml file
< bytecodeTargetLevel > < module name ="common_main" target ="1.8" /> < module name ="common_test" target ="1.8" /> < module name ="questionnaire_main" target ="1.8" /> < module name =" questionnaire_test" target ="1.8" /> </ bytecodeTargetLevel >
3. Change File->Project Structure->Project Settings->Modules->Project name->Dependencies->Module SDK on the right
4. Set the Target bytecode version of Module in Settings->Buile, Execution, Deployment->Compiler->Java Compiler