I have a trivial Maven project:
src
└── main
└── java
└── module-info.java
pom.xml
pom.xml:
org.
Specify maven.compiler.source and target versions.
1) Maven version which supports jdk you use. In my case JDK 11 and maven 3.6.0.
2) pom.xml
11
11
As an alternative, you can fully specify maven compiler plugin. See previous answers. It is shorter in my example :)
org.apache.maven.plugins
maven-compiler-plugin
3.8.0
11
3) rebuild the project to avoid compile errors in your IDE.
4) If it still does not work. In Intellij Idea I prefer using terminal instead of using terminal from OS. Then in Idea go to file -> settings -> build tools -> maven. I work with maven I downloaded from apache (by default Idea uses bundled maven). Restart Idea then and run mvn clean install again. Also make sure you have correct Path, MAVEN_HOME, JAVA_HOME environment variables.
I also saw this one-liner, but it does not work.
11
I made some quick starter projects, which I re-use in other my projects, feel free to check: