解决方案一:通过maven取运行时参数,eclipse提供的环境变量,基本类似System.getProperty("java.home")

  1. <dependency>
  2. <groupId>com.sun</groupId>
  3. <artifactId>tools</artifactId>
  4. <version>1.5.0</version>
  5. <scope>system</scope>
  6. <systemPath>${java.home}/lib/tools.jar</systemPath>
  7. </dependency>

如果不起作用的话,$(java.home)eclipse解析的不对,eclipse 没有使用 JAVA_HOME 默认,eclipse 使用 C:"windows"system32"javaw.exe 作为 JVM,当然找不到tools.jar

解决方法如下: 修改 eclipse.exe 目录下的 eclipse.ini 指定vm,注意 -vm后面不能有空格。


  1. -vm
  2. D:\Program Files\Java\jdk1.6.0_23\bin\javaw.exe
  3. -vmargs
  4. -Dosgi.requiredJavaVersion=1.6
  5. -Xms40m
  6. -Xmx512m
  7. -XX:PermSize=64M
  8. -XX:MaxPermSize=512M

注意: 要写在两行,写在一行不能生效
注意: 这两行要定在-vmargs之前,不然也不能生效

解决方案二:


  1. <properties>
  2. <project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
  3. <java.home>C:\Program Files\Java\jdk1.6.0_25</java.home>
  4. </properties>
  5. <profiles>
  6. <profile>
  7. <id>default-tools.jar</id>
  8. <activation>
  9. <activeByDefault>true</activeByDefault>
  10. <property>
  11. <name>java.vendor</name>
  12. <value>Sun Microsystems Inc.</value>
  13. </property>
  14. </activation>
  15. <dependencies>
  16. <dependency>
  17. <groupId>com.sun</groupId>
  18. <artifactId>tools</artifactId>
  19. <version>1.5.0</version>
  20. <scope>system</scope>
  21. <systemPath>${java.home}/lib/tools.jar</systemPath>
  22. </dependency>
  23. </dependencies>
  24. </profile>
  25. </profiles>
通过profile来设置,方便决定是否启用 
 
解决方案三:
 

  1. <dependency>
  2. <groupId>com.sun</groupId>
  3. <artifactId>tools</artifactId>
  4. <version>1.6.0</version>
  5. <scope>system</scope>
  6. <systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
  7. <optional>true</optional>
  8. </dependency>
直接使用Maven获取系统的环境变量

Eclipse maven工程 Missing artifact com.sun:tools:jar:1.7.0:system 解决方法的更多相关文章

  1. Eclipse maven工程 Missing artifact com.sun:tools:jar:1.5.0:system 解决方法

    今天同事在使用eclipse,引入一个新的maven工程时报错:      Missing artifact com.sun:tools:jar:1.6.0:system   这个问题很奇怪,相同的代 ...

  2. Maven错误-Missing artifact com.sun:tools:jar:1.5.0:system 解决方式

    1.Missing artifact com.sun:tools:jar:1.5.0:system Could not resolve dependencies for project com.ifl ...

  3. Missing artifact com.sun:tools:jar 1.5.0 终极解决方法

    在使用m2eclipse插件时,在pom.xml中添加struts2-core.jar包后,需要依赖java运行时的tools.jar进行依赖.但是,此时eclipse无法读取tools包,出现如下错 ...

  4. Missing artifact com.sun:tools:jar:1.5.0:system 补充

    转自:http://blog.csdn.net/sweblish/article/details/6662586 解决方案一: 原来,是${java.home}在作怪,eclipse 没有使用 JAV ...

  5. Missing artifact com.sun:tools:jar:1.5.0的解决方案

    今天在用maven的时候遇到一个问题pom.xml提示Missing artifact com.sun:tools:jar:1.5.0 试过改eclipse的eclipse.ini文件,也试过在ecl ...

  6. pom文件miss artifact com.sun:tools:jar:1.5.0:system问题

    问题现象: 导入新的maven项目时,有时候pom.xml文件会提示一个错误信息:Missing artifact com.sun:tools:jar:1.5.0:system 问题原因: maven ...

  7. Missing artifact com.sun:tools:jar:1.5.0解决的方法

    前一阵子下了最新的JavaEE版本号的eclipse,导入mavenproject之后,pom文件一直报Missing artifact com.sun:tools:jar:1.5.0.非常纳闷,to ...

  8. 开发常见错误之 :Missing artifact com.sun:tools:jar 1.7.0

    Missing artifact com.sun:tools:jar 1.7.0 解决办法一: 手动配置pom.xml,添加一个dependency如下: <dependency> < ...

  9. maven Missing artifact com.sun:tools:jar:1.5.0

    转自:http://blog.csdn.net/caolaosanahnu/article/details/7918929 http://zuoshahao.com/work/others/missi ...

随机推荐

  1. springcloud 中文文档

    spring cloud 中文文档:https://springcloud.cc/spring-cloud-dalston.html spring cloud 中文网:https://springcl ...

  2. Spring MVC灵活控制返回json的值(自定义过滤字段)

    在使用spring MVC开发过程中,为了提高项目执行效率,所以在一些外键字段的实体中会注解”@ManyToOne(fetch = FetchType.LAZY)”以实现延迟加载的效果. 但是,在使用 ...

  3. (18)使用模板(thymeleaf-freemarker)【从零开始学Spring Boot】

    整体步骤: (1)            在pom.xml中引入thymeleaf; (2)            如何关闭thymeleaf缓存 (3)            编写模板文件.html ...

  4. [Cypress] Test React’s Controlled Input with Cypress Selector Playground

    React based applications often use controlled inputs, meaning the input event leads to the applicati ...

  5. 【c语言】 模拟实现库函数的atoi函数

    // 模拟实现库函数的atoi函数 #include <stdio.h> #include <string.h> #include <assert.h> #incl ...

  6. 单片机显示原理(LCD1602)

    一.接口 LCD1602是很多单片机爱好者较早接触的字符型液晶显示器,它的主控芯片是HD44780或者其它兼容芯片.与此相仿的是LCD12864液晶显示器,它是一种图形点阵显示器,能显示的内容比LCD ...

  7. GitLab创建项目

    创建自己的项目:通过地址进入 在文件夹下使用git bash进行 git init,然后ctrl+右键使用TortoiseGit>右键setting 然后再右键setting 拷贝代码时注意要h ...

  8. CharsRefIntHashMap并不比HashMap&lt;String, Integer&gt;快

    我模仿lucene的BytesRef写了一个CharsRefIntHashMap,实測效果并不如HashMap<String, Integer>.代码例如以下: package com.d ...

  9. zoj3822 Domination 概率dp --- 2014 ACM-ICPC Asia Mudanjiang Regional Contest

    一个n行m列的棋盘,每次能够放一个棋子.问要使得棋盘的每行每列都至少有一个棋子 须要的放棋子次数的期望. dp[i][j][k]表示用了k个棋子共能占据棋盘的i行j列的概率. 那么对于每一颗棋子,在现 ...

  10. oc21--super

    // // Phone.h #import <Foundation/Foundation.h> typedef enum { kFlahlightStatusOpen, kFlahligh ...