source 1.3 中不支持泛型 解決辦法


原文地址:http://greenlight.blog.51cto.com/3159513/687547


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。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章