如何配置Eclipse和Maven以检测jdk.tools? [英] How do I configure Eclipse and Maven to detect jdk.tools?

查看:86
本文介绍了如何配置Eclipse和Maven以检测jdk.tools?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中有一个Maven项目,在这里我使用了一些hadoop库(hadoop-common,hadoop-auth,hadoop-hdfs),这些都带来了对jdk.tools的依赖.当我在另一台机器上检出该项目时,它可以正常工作,但在我的pom.xml上抱怨缺少工件jdk.tools:jdk:tools:jar:1.6".我可以通过手动添加依赖项并在本地驱动器上指定文件(例如"$ {JAVA_HOME}/../lib/tools.jar")来解决此问题,但是我想了解为什么它可以在一台计算机上而不是在一台计算机上运行另一个-我假设我的设置有问题吗?

I have a maven project in Eclipse where I am using some hadoop libraries (hadoop-common, hadoop-auth, hadoop-hdfs) and these bring in a dependency on jdk.tools. When I check this project out on a different machine, it works fine, but on mine the pom.xml complains about "missing artifact jdk.tools:jdk:tools:jar:1.6". I can fix this by adding a dependency manually and specifying the file on my local drive (eg "${JAVA_HOME}/../lib/tools.jar") but I would like to understand why it works on one computer and not on another - I am assuming there is something wrong with my setup?

我尝试了以下操作:

通过在我的eclipse.ini文件中添加"-vm C:\ Program Files \ Java \ jdk1.6.0_25 \ bin \ javaw.exe",确保Eclipse在JDK中运行.Eclipse首选项Java->已安装的JRE下列出的唯一JRE是相同的JDK.尝试在Eclipse首选项中切换Maven版本Maven->在嵌入式​​(3.0.4)",外部(3.0.4)"和外部(2.2.1)"之间进行安装

Made sure Eclipse is running in a JDK by adding "-vm C:\Program Files\Java\jdk1.6.0_25\bin\javaw.exe" to my eclipse.ini file. The only JRE listed under Eclipse preferences Java -> Installed JREs is the same JDK. Tried switching maven version in Eclipse preferences Maven -> Installations between "Embedded (3.0.4)", "External (3.0.4)" and "External (2.2.1)"

也许我需要在我的maven settings.xml文件中添加/更改某些内容?

Maybe something I need to add/change in my maven settings.xml file?

任何建议将不胜感激!

仅供参考,我正在使用Eclipse Java EE Juno SR1和M2E 1.2.0.

FYI I am using Eclipse Java EE Juno SR1 and M2E 1.2.0.

推荐答案

JAVA_HOME应该指向安装Java的文件夹在settings.xml文件中,确保您具有JAVA_HOME属性,并且它指向正确的文件夹

JAVA_HOME should point to the folder where java is installed in settings.xml file make sure you have JAVA_HOME property and it point to correct folder

$ {JAVA_HOME}/../lib/tools.jar不正确.应该是$ {JAVA_HOME}/lib/tools.jar,因为tools.jar在/lib文件夹下,而/lib文件夹在$ {JAVA_HOME}文件夹下

${JAVA_HOME}/../lib/tools.jar is not correct. it should be ${JAVA_HOME}/lib/tools.jar, since tools.jar is under /lib folder and /lib folder is immediately under ${JAVA_HOME} folder

这篇关于如何配置Eclipse和Maven以检测jdk.tools?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆