简体   繁体   English

Eclipse插件在本地Maven存储库中找不到工件

[英]Eclipse plugin does not find artifacts in local maven repo

I have a multi module maven project, which builds fine on the command line. 我有一个多模块Maven项目,可以在命令行上很好地构建。 When I import the project into eclipse, it complains, that some dependencies cannot be resolved. 当我将项目导入eclipse时,它抱怨说某些依赖项无法解决。 Most dependencies do get resovled just fine. 大多数依赖确实可以很好地解决。

I'm getting this error messgae for some dependencies: 我得到一些依赖的错误信息:

Missing artifact com.visual-paradigm.hibernate:orm:jar:20140430 pom.xml /lir    line 2  Maven Dependency Problem

I checked the eclipse maven config and I can see that the dependencies are actually in the local repo. 我检查了Eclipse Maven配置,可以看到依赖项实际上在本地存储库中。

Any ideas how to get eclipse/maven to resolve this dependencies? 有什么想法如何让Eclipse / Maven解决此依赖性吗?

you can try updating settings.xml to be used by plugin. 您可以尝试更新settings.xml以供插件使用。

在此处输入图片说明

Also try updating maven instance eclipse is using. 也可以尝试更新正在使用的Maven实例。

Edit 1 In eclipse .classpath file see if the entry is present for given jar. 编辑1在eclipse .classpath文件中,查看给定jar是否存在该条目。 I believe there should be entries for other jars as you have mentioned in eclipse. 我相信您应该在eclipse中提到其他罐子的条目。 like this 像这样

  <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>

Now there can be 2 cases with it 现在有2种情况

  1. classpath entry is present and somehow jar is not located on specified path. 存在类路径条目,并且jar不在指定的路径上。
  2. classpath entry is absent, if not a quick fix would be manually adding it. 没有classpath条目,如果没有的话,可以手动添加它。

After all it turned out, that the missing dependencies were added to the repo using copy paste instead of using install:install-file . 事实证明,缺少的依赖项是使用复制粘贴而不是使用install:install-file添加到回购中的。 Therefore some meta information in the repo was missing. 因此,回购中缺少一些元信息。

Deleting them and readding with install:install-file solved the problem. 删除它们并使用install:install-file读取即可解决该问题。

What's still puzzling is that on the command line maven was happy with this. 仍然令人困惑的是,在命令行上,maven对此感到满意。 Even kicking off maven install from eclipse was working fine. 甚至从eclipse开始进行Maven安装都运行良好。 It's just the m2eclipse plugin that has a problem with this. 只是m2eclipse插件对此有问题。

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

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