Maven编译创建工件并将其复制到本地存储库时出错

时间:2015-08-20 14:08:19

标签: java maven

我有这个编译错误un maven

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on
a JRE rather than a JDK?
[INFO] 1 error

但这不可能,因为我的路径中有jdk:;..;C:\PROGRA~2\Java\jdk1.7.0_71\bin

C:\Development\Workspaces\EclipseWS\devices-project>java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

这里是mvn -v:

C:\Users\joanet>mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:
28+0100)
Maven home: C:\apache-maven-3.0.5\bin\..
Java version: 1.7.0_71, vendor: Oracle Corporation
Java home: C:\PROGRA~2\Java\jdk1.7.0_71\jre
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

1 个答案:

答案 0 :(得分:2)

如果你运行mvn -v,你会看到Maven认为它正在使用

e.g。

Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-15T03:59:23+10:30)
Maven home: /usr/local/Cellar/maven/3.2.5/libexec
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"

您的问题是否是这些StackOverflow错误之一?

Eclipse/Maven error: "No compiler is provided in this environment"

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Maven error :Perhaps you are running on a JRE rather than a JDK?

Maven Package Compilation Error

或任何其他谷歌答案。