Zhang Kaitao's Shiro code was recently forked from GitHub, and the IDE is IntelliJ idea. The default language level is JDK 1.5 for both project and module, and each modification is limited to the current one and will later be changed back to JDK 1.5.
Search, the solution is the compiler version specified in this pom.xml, as follows:
<Build> <Plugins> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-compiler-plugin</Artifactid> <version>2.3.2</version> <Configuration> <Source>1.8</Source> <Target>1.8</Target> </Configuration> </plugin> </Plugins></Build>
There is also a concise version:
< Properties > < Maven.compiler.source >1.8</maven.compiler.source> < Maven.compiler.target>1.8</maven.compiler.target> </ Properties >
The reason for this is the MAVEN compiler plugin own problem:
Apache Maven Compiler Plugin Javax.tools.JavaCompiler The default source setting is 1.5 and the default target setting is 1.5 independently of the JDK you run Mavenwith. If you want to change these defaults, you should set source and target as described in Setting the-source and-target of The Java Compiler.
The content of the above paragraph is:
The plugin starts with version 3.0, the default compiler is Javax.tools.JavaCompiler (provided that JDK 1.6 is available), and you need to set it manually if you want to use Javac.
Currently (version:3.5.1), using JDK 1.5 to parse and compile the source by default , regardless of the JDK version running MAVEN !!! If you want to change, see the link.
PS, the contents of the link are as follows:
<Project> [...] <Build> [...] <Plugins> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-compiler-plugin</Artifactid> <version>3.5.1</version> <Configuration> <Source>1.8</Source> <Target>1.8</Target> </Configuration> </plugin> </Plugins> [...] </Build> [...] </Project>
Reference:
http://stackoverflow.com/questions/27037657/stop-intellij-idea-to-switch-java-language-level-everytime-the-pom-is-reloaded
Http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
Http://docs.oracle.com/javase/8/docs/api/javax/tools/JavaCompiler.html
Intellij idea Module's language level problem