maven错误(1.3不支持泛型)

maven打包时始终出现以下提示:

      1、-source 1.3 中不支持泛型(请使用 -source 5 或更高版本以启用泛型)List<User> userList= new ArrayList<User>();

      2、-source 1.3 中不支持注释(请使用 -source 5 或更高版本以启用注释)@WebService(endpointInterface = "com.webservice.service.LoadService")

    而用命令mvn -v查看结果:

C:\Users\Administrator>mvn -v
Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)
Java version: 1.6.0
Java home: D:\Program Files\Java\jdk1.6.0\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows vista" version: "6.1" arch: "x86" Family: "windows"

    显然与所配置的JDK无关。

    最终解决办法:

    在项目的pom.xml中,添加   

<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>

    再执行mvn install,OK。

猜你喜欢

转载自cheneyph.iteye.com/blog/758883