macOS系统编译Maven项目时报错:Could not find artifact com.sun:tools:jar:1.5.0
在Mac上的终端输入命令 mvn clean package -e -U 进行项目的编译时,报错:
Could not resolve dependencies for project com.XXXX :jar:1.0-SNAPSHOT: Could not find artifact com.sun:tools:jar:1.5.0 at specified path /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/../lib/tools.jar
导致 “BUILD FAILURE”
疯狂百度,试了很多很多方法呀!
法一:在pom.xml文件中添加依赖( https://blog.csdn.net/kobe269/article/details/39970793)——不行
还是无济于事……
————————————————————————
最后求助Colleague,需要在 pom.xml 文件中手动加入 以下内容:(直接将tools.jar的路径写死~不要用相对路径了)
(其中的systemPath为实际的jdk中tools.jar的路径)
内容为:
<dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.5.0</version> <scope>system</scope> <systemPath>/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib/tools.jar</systemPath> </dependency>
完了之后重新编译项目,mvn clean package -e -U
posted on 2021-02-23 19:57 CuriousZero 阅读(1335) 评论(0) 编辑 收藏 举报