maven2编译的默认版本是JDK1.3(有点低),由于项目使用hibernate-annotations,所以编译的时候必须使用JDK1.5才可以,在maven2的官方文档中正好有一个这样的例子,只要在工程的POM.XML中加入下面这些代码就可以使用JDK1.5来编译了
<
build
>
< plugins >
< plugin >
< groupId > org.apache.maven.plugins </ groupId >
< artifactId > maven-compiler-plugin </ artifactId >
< configuration >
< source > 1.5 </ source >
< target > 1.5 </ target >
</ configuration >
</ plugin >
</ plugins >
</ build >
< plugins >
< plugin >
< groupId > org.apache.maven.plugins </ groupId >
< artifactId > maven-compiler-plugin </ artifactId >
< configuration >
< source > 1.5 </ source >
< target > 1.5 </ target >
</ configuration >
</ plugin >
</ plugins >
</ build >