reference:
http://blog.sina.com.cn/s/blog_725eee7e0100ymoz.html
http://blog.csdn.net/hehexiaoyou/article/details/27229881
http://blog.163.com/cn_dreamgo/blog/static/526794522013992739946/
The new Maven Project, which is the default JDK 1.5
Modified in two ways.
1. Modify conf / settings.xml under maven directory for the overall situation.
In the profiles node is added:
<profile>
<id>jdk-1.7</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.7</jdk>
</activation>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
</properties>
</profile>
JDK version here can be modified.
Modify and then create a new project:
2. modify the pom.xml for the project file, and then use the maven command line (mvn clean, mvn package), you can get to specify jdk version of the compiler jar package.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>${file_encoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
After modifying pom.xml, and execute mvn clean mvn package, and then view the generated class file is generated by what version of the JDK.