我尝试按照在Mac OS X安装Java JDK 7后,mvn -version仍然显示Java版本1.6.0_31的说明进行操作,但它们并没有解决我的问题。 :-(
当我运行以下命令时:
运行以下命令的输出结果为:
当我运行以下命令时:
mvn clean install
I get the following issue:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building JBehave JUnit Runner 1.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jbehave-junit-runner ---
[INFO] Deleting /Users/skurlow/IdeaProjects/mygithubforks/jbehave-junit-runner/target
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ jbehave-junit-runner ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jbehave-junit-runner ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/skurlow/IdeaProjects/mygithubforks/jbehave-junit-runner/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ jbehave-junit-runner ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to /Users/skurlow/IdeaProjects/mygithubforks/jbehave-junit-runner/target/classes
[INFO] -------------------------------------------------------------
[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
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.164 s
[INFO] Finished at: 2014-04-18T07:25:53+10:00
[INFO] Final Memory: 11M/126M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project jbehave-junit-runner: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
我已经安装了Oracle的JDK7:
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
我在pom.xml中添加了以下内容,因为Maven在某种程度上决定使用1.5的源代码和目标代码而不是1.7:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
当我运行以下命令时:
mvn clean install -X
我看到它告诉我正在使用 JRE 而不是 JDK。但是我无论如何都不能让 Maven 使用 JDK 而不是 JRE。:-(
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T04:37:52+10:00)
Maven home: /Users/skurlow/tools/apache-maven-3.2.1
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
运行以下命令的输出结果为:
mvn --version
is:
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-15T04:37:52+10:00)
Maven home: /Users/skurlow/tools/apache-maven-3.2.1
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"
运行以下命令的输出结果:
javac -version
是:
javac 1.7.0_55
mvn --version
的输出结果。 - jmjjavac -version
的输出是什么? - tmarwenjavac -version
信息。 - dragonsfire