2011-11-18 60 views
1

我使用maven2构建java项目,当我发出命令mvn clean install时我收到错误could not parse error message: (use -source 5 or higher to enable generics)Issus使用maven2构建java项目

在我的eclipse环境中,我使用jdk 1.7并且项目工作正常。当我想要构建项目时,我无法做到这一点,认为maven正在将java版本1.3作为默认值。

任何一个请帮助我如何的jdk versio设置为1.7的行家,成功地构建项目..

从我想补充添加自己的罐子在pom.xml中提到的罐子

除此之外,如何我可以指定,在POM XML?

在此先感谢..

回答

4

在你的pom.xml配置Maven的编译器插件使用1.6:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.2</version> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
+0

org.apache.maven.plugins maven-编译器插件 true true 1.7 \t user972590

+0

我加入到这一点的pom.xml,但不工作 – user972590

+0

除了将OP想要使用V1.7 ;-) – Puce