Whenever you create a new maven project using IntelliJ IDEA, if you get the following error
“Error: java: error: release version 5 not supported”
The reason is Maven sets the default Java version to 1.5. Hence you need to set the language level and release version in pom.xml file correctly.
Do the following:
File => Settings => Build, Execution, Deployment => Compiler => Java Compiler and change it if required.
If it does not work even after changing the JAVA version, go for the following solutions:
1. 1. Set the source /target versions in pom.xml like below:
<properties>
<maven.compiler.source>1.11</maven.compiler.source>
<maven.compiler.target>1.11</maven.compiler.target>
</properties>
To include the maven-compiler-plugin if you have not already like:
plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.11</source>
<target>1.11</target>
</configuration>
</plugin>
</plugins
If The above-mentioned solution did not work for you, you can move one step further by changing the “language level” in every module at, File => Project Structure => Modules
If you want to learn more about Java, then go through this Java tutorial by Intellipaat for more insights.