简体   繁体   English

由于缺少Mac中的tools.jar,Maven项目无法编译

[英]Maven project couldn't compile due to missing tools.jar, in mac

The problem is pretty much the same as listed here: JDK tools.jar as maven dependency 问题与此处列出的问题几乎相同: 作为Maven依赖项的JDK tools.jar

But I have tried all of the solutions, none of them works for me. 但是我尝试了所有解决方案,但没有一个适合我。 All of them says 他们都说

ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.0.0.RC4:run (default-cli) on project gs-rest-service: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:1.0.0.RC4:run failed: Plugin org.springframework.boot:spring-boot-maven-plugin:1.0.0.RC4 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.6 at specified path /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../lib/tools.jar -> [Help 1]

Through my early googling, it seems in mac it is replaced by classes.jar. 通过我的早期谷歌搜索,似乎在mac中被classes.jar取代了。 I tried to change java_home to "..../Contents/", error remains as ".../Contents/Home/../lib/tools.jar" 我试图将java_home更改为“ .... / Contents /”,错误仍然显示为“ ... / Contents / Home /../ lib / tools.jar”

I am new to Maven and am following this tutorial to build a simple REST WS with Spring: http://spring.io/guides/gs/rest-service/ 我是Maven的新手,正在按照本教程使用Spring构建简单的REST WS: http : //spring.io/guides/gs/rest-service/

You can add tools.jar as dependency in POM.xml , with "scope"= "system" and "systemPath" equals to "/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/tools.jar " 您可以将tools.jar作为依赖项添加到POM.xml中,其中“ scope” =“ system”,并且“ systemPath”等于“ /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/tools”。罐子

Hope this helps 希望这可以帮助

Regards 问候

Jyotsna Jyotsna

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM