IDEA: Source Release 1.7 Requires Target Release 1.7
When executing a JUnit test in IntelliJ IDEA, you might encounter the following error: "javac: source release 1.7 requires target release 1.7." This issue stems from mismatched source and target release configurations.
To address this error, ensure that the following settings are correctly configured:
Compiler Options:
Verify that the compiler options imported from Maven are correct:
Project and Module Settings:
Maven Settings:
IntelliJ IDEA Specific:
Once the above configurations are set, reimport the Maven project in IntelliJ IDEA to ensure that it respects the updated settings.
Additional Sources for Language Level Configuration:
Default Maven Language Level:
Note that Maven's default language level is 1.5 (5.0). IntelliJ IDEA will initially set the module language level to this value.
The above is the detailed content of Why Does My JUnit Test Fail with 'javac: source release 1.7 requires target release 1.7' in IntelliJ IDEA?. For more information, please follow other related articles on the PHP Chinese website!