简体   繁体   English

如何解决在eclipse中通过maven导入的java项目中的依赖项?

[英]How to resolve the dependencies in the java project which is imported through maven in eclipse?

I have imported multiple projects in eclipse through maven. 我通过maven在eclipse中导入了多个项目。 After importing the projects in eclipse I saw that there are some error on the project folder in project explorer. 在eclipse中导入项目后,我发现项目浏览器中的项目文件夹有一些错误。 All that errors are on pom.xml. 所有错误都在pom.xml上。

When I opened pom.xml the error is like this: 当我打开pom.xml时,错误是这样的:

Project build error: Non-resolvable parent POM: Failure to find org.openhie.openempi:openempi:pom:2.2.5 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM

How to resolve this errors in eclipse? 如何在eclipse中解决这个错误? I tried a lot by adding the missing JAR's as specified in error message sometime, but still the errors are highlighting on pom.xml. 我尝试了很多时候添加错误消息中指定的缺少的JAR,但仍然在pom.xml上突出显示错误。

Please advice me for this. 请告诉我这个。

Thanks 谢谢

Install http://www.eclipse.org/m2e/ via the eclipse marketplace. 通过eclipse市场安装http://www.eclipse.org/m2e/ The plugin adds a 该插件添加了一个

classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" classpathentry kind =“con”path =“org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER”

entry in the .classpath file for eclipse and every jar from the maven dependencies will be in your classpath. eclipse的.classpath文件中的条目以及maven依赖项中的每个jar都将在您的类路径中。

You have a maven plugin that does that. 你有一个maven插件,可以做到这一点。 You have to go with the command line at the root of your maven project and type 您必须使用maven项目根目录下的命令行并键入

mvn eclipse:eclipse

It will create (or update) an eclipse project with dependencies to the jar located in your local maven repository, and the eclipse project artifacts (.project, .classpath and other stuff) in the same repository. 它将创建(或更新)一个eclipse项目,该项目依赖于位于本地maven存储库中的jar ,以及同一存储库中的eclipse项目工件(.project,.classpath和其他东西)。

Then import your project in eclipse using "Import existing project" wizard. 然后使用“导入现有项目”向导在eclipse中导入项目。

http://maven.apache.org/guides/mini/guide-ide-eclipse.html for more information http://maven.apache.org/guides/mini/guide-ide-eclipse.html了解更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM