3

私は春の公式ガイドの1つをいじっていました:http://spring.io/guides/gs/maven/

しかし、y が maven でコンパイルしなければならない部分に到達すると、次のようになります。

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building gs-maven-initial 0.1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gs-maven-i
nitial ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory c:\Java\WorkSpace\maven_beginer\src\m
ain\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ gs-maven-init
ial ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[INFO] Compiling 2 source files to c:\Java\WorkSpace\maven_beginer\target\classe
s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.692s
[INFO] Finished at: Wed Nov 06 23:51:21 ART 2013
[INFO] Final Memory: 9M/102M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
5.1:compile (default-compile) on project gs-maven-initial: Fatal error compiling
: tools.jar not found: C:\Java\jdk\..\lib\tools.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
4

2 に答える 2

10

Windows -> Preferences Java -> Installed JREs に移動します。

v

JREをJDKに変更

于 2014-06-12T05:05:54.967 に答える
3

この問題は次の方法で解決できます。

  1. JAVA_HOME をシステム変数に追加
  2. または c:\program files または c:\program files (x86) から c:\ に Java フォルダーをコピーします。
  3. または、ローカル リポジトリに tools.jar がないと、m2eclipse が壊れます
于 2013-11-07T04:14:01.427 に答える