问题与此处列出的问题几乎相同: JDK tools.jar as maven dependency
但是我已经尝试了所有的解决方案,但没有一个适合我。他们都说
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]
通过我早期的谷歌搜索,似乎在mac中它被classes.jar取代了。 我尝试将 java_home 更改为“..../Contents/”,错误仍然为“.../Contents/Home/../lib/tools.jar”
我是 Maven 新手,正在按照本教程使用 Spring 构建一个简单的 REST WS: http://spring.io/guides/gs/rest-service/
最佳答案
您可以将tools.jar添加为POM.xml中的依赖项,其中“scope”=“system”并且“systemPath”等于“/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/tools.jar“
希望这有帮助
问候
乔茨纳
关于java - Maven 项目在 mac 中由于缺少tools.jar而无法编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22375831/