java - Maven 项目在 mac 中由于缺少tools.jar而无法编译

标签 java spring macos maven

问题与此处列出的问题几乎相同: 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/

相关文章:

java - 如何通过负 int 值检查退出 Double ArrayList 的 While 循环?

java - 从 request.getParameter() 获取输入类型 ="image"值

java - 在 main 方法之外创建对象时出现 stackoverflow 错误

java - 匹配数据库中的哈希密码和加盐密码

java - Hibernate 不会通过合并或更新来更新实体

spring - hibernate 异常 : Use of DefaultSchemaNameResolver requires Dialect to provide the proper SQL statement/command

java - 如何更改 XML 以让 hibernate 定义数据源

macos - 在 Mac OS X 中将所有窗口移动到单个监视器(连接两个)?

objective-c - AVPlayerView Mac : How to disable all user interaction?

macos - GCC运行汇编程序mac?