MAC和windows开发操作系统环境,解决Maven工程中报 Missing artifact jdk.tools:jdk.tools

同事使用的是苹果mac,而我们其他人的开发环境是windows jdk1.8 导致同事从git上pull下来的工程,pom文件是直接报错的,

windows下的pom文件设置是这样的:

1 <dependency>
2       <groupId>jdk.tools</groupId>
3       <artifactId>jdk.tools</artifactId>
4       <version>1.7</version>
5       <scope>system</scope>
6       <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
7  </dependency>  

 

如果开发环境团队操作系统不统一,可以修改成如下来指定路径:

 1  1   <profile>
 2  2      <id>default-profile</id>
 3  3      <activation>
 4  4       <activeByDefault>true</activeByDefault>
 5  5       <file>
 6  6          <exists>${java.home}/../lib/tools.jar</exists>
 7  7       </file>
 8  8       </activation>
 9  9      <properties>
10 10         <toolsjar>${java.home}/../lib/tools.jar</toolsjar>
11 11      </properties>
12 12   </profile>
13 13   <profile>
14 14      <id>mac-profile</id>
15 15      <activation>
16 16      <activeByDefault>false</activeByDefault>
17 17       <file>
18 18        <exists>${java.home}/../Classes/classes.jar</exists>
19 19       </file>
20 20      </activation>
21 21      <properties>
22 22       <toolsjar>${java.home}/../Classes/classes.jar</toolsjar>
23 23      </properties>
24 24   </profile>
25 25  </profiles>
26 26  <dependencies>
27 30     <dependency>
28 31      <groupId>com.sun</groupId>
29 32      <artifactId>tools</artifactId>
30 33      <version>1.7</version>
31 34      <scope>system</scope>
32 35      <systemPath>${toolsjar}</systemPath>
33 36   </dependency>

代码经过测试可以直接使用的,环境非特定设置,默认开发环境,如果开发环境不同,路径等问题,可以根据情况修改配置参数,如版本号或路径。

MacX中的JDK和Oracle JDK(原来SUN JDK)提供的实现有很大不同,其中一个就是没有tools.jar,在classes.jar中已经包括了Oracle JDK tools.jar中的内容。 

转载于:https://www.cnblogs.com/ried12138/p/9317935.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值