`

Maven_ERROR无效的目标版本

 
阅读更多

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-complier-plugin:3.1:compile (default-compile) on project xxx:Fatal error compliling: 无效的目标版本: 1.7 -> [Help 1]

 

查看maven环境

C:\Users\Administrator>mvn -v

Listening for transport dt_socket at address: 8088

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T01:29:23+08:00)

Maven home: D:\apache-maven-3.2.5

Java version: 1.6.0_43, vendor: Sun Microsystems Inc.

Java home: C:\Program Files\Java\jdk1.6.0_43\jre

Default locale: zh_CN, platform encoding: GBK

OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

C:\Users\Administrator>

 

$ mvn test 时出现这个错误是因为Maven的环境是jdk1.6,而Maven可能根据pom.xml上下文配置默认为jre1.7,故解决办法就是在pom.xml中指定jdk版本,这样就不再报错

 

最终的pom.xml如下

<build>

<plugins>

<!--

<plugin>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-maven-plugin</artifactId>

</plugin>

-->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.6</source>

<target>1.6</target>

<encoding>UTF-8</encoding>

</configuration>

</plugin>

</plugins>

</build>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics