我在import maven项目时,pom.xml报错Missing artifact com.sun:tools:jar:1.5.0,经过盘查发现是pom引入的struts2相关jar包导致报错。

上网查询说是struts2-core.jar需要依赖Java运行时的tools.jar,解决方案就是将这个jar包手动引入。

解决方案一:

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

<version>是你本地jdk版本,必须指定。

如果还报错,就是你的<systemPath>jar包的路径不对,不放心就写绝对地址,比如我的是:C:\Program Files\java\jdk1.7.0_80\lib\tools.jar。

吐嘈下网上关于这个地址的写法有<systemPath>${JAVA_HOME}/../lib/tools.jar</systemPath>,还有<systemPath>${java.home}/../lib/tools.jar</systemPath>拿到我这来都不好使,我个就是我踩的坑,直接写绝对地址就好了。

解决方案二:

将tools.jar拷贝到你的的本地仓库并改名。路径为.m2\repository\com\sun\tools\1.5.0\tools-1.5.0.jar。

同时要新建tools-1.5.0.pom文件,内容如下:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>com.sun</groupId>
  6. <artifactId>tools</artifactId>
  7. <version>1.5.0</version>
  8. </project>

然后在pom.xml中按如下引入:

  1. <dependency>
  2. <groupId>com.sun</groupId>
  3. <artifactId>tools</artifactId>
  4. <version>1.5.0</version>
  5. </dependency>

这种方式,你必须要新建.pom文件才能引入成功的,这个也是我踩的坑。

至于还其他网友说的在eclipse.ini中配置vm参数的,我试了不起作用。以上2种就够用了。

Error:(13, 60) java: 程序包com.sun.tools.internal.xjc.reader.xmlschema.bindinfo不存在的更多相关文章

  1. Caused by: java.lang.ClassNotFoundException: com/sun/tools/internal/xjc/api/XJC

    Caused by: java.lang.ClassNotFoundException: com/sun/tools/internal/xjc/api/XJC 缺少com/sun/tools/inte ...

  2. SpringBoot启动项目时提示:Error:(3, 32) java: 程序包org.springframework.boot不存在

    场景 在IDEA中新建SpringBoot项目,后启动项目时提示: Error:(3, 32) java: 程序包org.springframework.boot不存在 实现 将pom.xml中par ...

  3. Error:(4, 17) java: 程序包org.junit不存在

    内容:Error:(4, 17) java: 程序包org.junit不存在 场景:运行测试类的时候,IED新建一个自己的项目,并且不用maven的情况下 解决方案:File -> Projec ...

  4. java: 程序包com.sun.media.jai.codec不存在

    Q:IDEA编译时提示"java: 程序包com.sun.media.jai.codec不存在" A:添加下面的repository到pom.xml中 <repository ...

  5. 错误: 程序包com.sun.istack.internal不存在

    eclipse下maven打包是出现如下错误: [ERROR] D:\code-old\daba_user_mvn\src\main\java\com\dada\transaction\service ...

  6. Intellij Idea上Spring Boot编译报错:Error:(3, 32) java: 程序包org.springframework.boot不存在

    很尴尬,为了使用Spring Boot的Initializr,特意下了个Intellij Idea,刚按提示新建一个Spring Boot的Maven项目后,就出现红叉叉了.因为IDE是新的,开始是M ...

  7. springBoot 打war包 程序包com.sun.istack.internal不存在的问题

    使用的是 idea - Lifecycle-package 的方式打包(maven) 确认  <packaging>war</packaging> 修改启动类: (原启动类) ...

  8. “程序包com.sun.tools.javac.util不存在” 问题解决

    最近工作中在编译打包项目的时候遇到了如标题所示的问题,报这个错误的类是 com.sun.tools.javac.util.Pair.问题很诡异,在Idea可以导入此类,项目启动运行也很正常,但就是在打 ...

  9. SpringBoot从1.5.1→2.2.4项目加包扫雷一:Error:(8, 44) java: 程序包org.springframework.boot.web.support不存在

    更换成新包即可import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

随机推荐

  1. JSR教程2——Spring MVC数据校验与国际化

    SpringMVC数据校验采用JSR-303校验. • Spring4.0拥有自己独立的数据校验框架,同时支持JSR303标准的校验框架. • Spring在进行数据绑定时,可同时调用校验框架完成数据 ...

  2. ADNI以及study design简介

    相关名词: MCI:轻度认知功能障碍 EMCI:早期认知障碍 MCI:轻度认知障碍 LMCI:晚期认知障碍 CN:认知正常的志愿者 DTI:doppler tissue imaging,多普勒组织显像 ...

  3. java微信公众号JSAPI支付以及所遇到的坑

    上周做了个支付宝微信扫码支付,今天总结一下.微信相比支付宝要麻烦许多 由于涉及到代理商,没办法,让我写个详细的申请流程,懵逼啊. 笔记地址 http://note.youdao.com/notesha ...

  4. Java变量的默认值和初始化

    Java变量的默认值和初始化 学习自 <Thinking In Java> 技术小黑屋-为什么局部变量需要显式设置初始化值 变量的默认值 注意只有成员变量才有默认值,而局部变量必须要赋初值 ...

  5. android listview 优化

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha android convertview作用 ======= 1,convertView复 ...

  6. Codeforces Round #375 (Div. 2) D. Lakes in Berland 贪心

    D. Lakes in Berland 题目连接: http://codeforces.com/contest/723/problem/D Description The map of Berland ...

  7. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem A. Alien Visit 计算几何

    Problem A. Alien Visit 题目连接: http://codeforces.com/gym/100714 Description Witness: "First, I sa ...

  8. Delphi : Analyze PE file headers?

    Analyze PE file headers? { You'll need a OpenDialog to open a Exe-File and a Memo to show the file i ...

  9. What is OpenOCD?

    About OpenOCD was created by Dominic Rath as part of a 2005 diploma thesis written at the University ...

  10. OpenOCD Debug Adapter Configuration

    Correctly installing OpenOCD includes making your operating system give OpenOCD access to debug adap ...