Java Pom.xml 项目构建错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19921311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pom.xml project build error
提问by Y0gesh Gupta
I have imported maven projects in my eclipse, but I am getting the following error in pom.xml-
我在 Eclipse 中导入了 Maven 项目,但是在 pom.xml- 中出现以下错误
Project build error: 'dependencyManagement.dependencies.dependency.systemPath' for jdk.tools:jdk.tools:jar must specify an absolute path but is ${JAVA_HOME}/lib/tools.jar
项目构建错误:'dependencyManagement.dependencies.dependency.systemPath' for jdk.tools:jdk.tools:jar 必须指定绝对路径,但为 ${JAVA_HOME}/lib/tools.jar
I am kind of new to maven, any help will be appreciated.
我对 maven 有点陌生,任何帮助将不胜感激。
采纳答案by Sam Hanes
You've specified a dependency on jdk.tools:jdk.tools:jar
with a <systemPath>
of ${JAVA_HOME}/lib/tools.jar
. ${JAVA_HOME}
is not a valid Maven property. The syntax to read the environment variable JAVA_HOME
is ${env.JAVA_HOME}
. However, the same information is exposed as a system propertynamed java.home
, so ${java.home}
is the best solution.
您已jdk.tools:jdk.tools:jar
使用<systemPath>
of指定了依赖项${JAVA_HOME}/lib/tools.jar
。${JAVA_HOME}
不是有效的Maven 属性。读取环境变量的语法JAVA_HOME
是${env.JAVA_HOME}
. 但是,相同的信息作为名为的系统属性公开java.home
,因此${java.home}
是最佳解决方案。
回答by Doss
Look for tools.jar
which should be in jdk/lib
, if not mean download latest jdk or add tools.jar
to this location. This should fix the issue.
寻找tools.jar
哪个应该在jdk/lib
,如果不是意味着下载最新的 jdk 或添加tools.jar
到这个位置。这应该可以解决问题。