简体   繁体   English

当mvn命令行没有时,为什么M2Eclipse会抱怨缺少工件?

[英]Why does M2Eclipse complain about missing artifact when mvn command line doesn't?

I've just set up a brand new installation of Eclipse Helios and have configured M2Eclipse to use an external (v 2.2.1) installation of Maven. 我刚刚设置了Eclipse Helios的全新安装,并已将M2Eclipse配置为使用Maven的外部(v 2.2.1)安装。

The system compiles fine on the command line, but from within M2Eclipse several of my project modules have an error: 系统在命令行上编译很好,但是从M2Eclipse中我的几个项目模块都有错误:

Missing artifact javax.jms:jms:jar:1.1:test

I can get past the error by excluding the jms artifact from the Atomikos dependencies. 我可以通过从Atomikos依赖项中排除jms工件来解决错误。 But my main question is how can the two provide different results! 但我的主要问题是两者如何提供不同的结果!

Even more odd is that I have another installation of Eclipse Helios and everything works fine. 更奇怪的是,我有另一个Eclipse Helios安装,一切正常。

The dependency resolver in m2eclipse is not using the external Maven installation, it has to use the embedded Maven version. m2eclipse中的依赖解析器没有使用外部Maven安装,它必须使用嵌入式Maven版本。 So, I'd recommend to get the latest version of m2eclipse, as well as Maven 3.x version to minimize the difference in dependency resolution. 因此,我建议获取最新版本的m2eclipse以及Maven 3.x版本,以最大限度地减少依赖项解析的差异。

Additionally, it is possible that you had some alternative repositories defined in your maven 2.2.1 conf/settings.xml file. 此外,您可能在maven 2.2.1 conf / settings.xml文件中定义了一些备用存储库。 If you use the embedded maven3 these will be ignored. 如果使用嵌入式maven3,这些将被忽略。

You also can specify your maven 2.2.1 installation as the maven installation for m2eclipse. 您还可以将maven 2.2.1安装指定为m2eclipse的maven安装。

I posted a similar question and finally found an answer. 我发布了一个类似的问题,终于找到了答案。 See m2eclipse says "Missing artifact" but I can build from cmdline! 请参阅m2eclipse说“缺少工件”,但我可以从cmdline构建!
You can find a different solution at http://getsatisfaction.com/sonatype/topics/_missing_artifact_from_m2eclipse_but_it_is_not_true 您可以在http://getsatisfaction.com/sonatype/topics/_missing_artifact_from_m2eclipse_but_it_is_not_true找到不同的解决方案。

Same problem here: I use maven 2.2.1 as the installation to use from eclipse, as it is the one which works on the command line. 同样的问题:我使用maven 2.2.1作为从eclipse使用的安装,因为它是在命令行上运行的。 Maven 3 does not work for this concrete project, complaining about some missing dependencies which, after much research, in my case turned out to come from old maven 1 repositories with legacy layout. Maven 3不适合这个具体的项目,抱怨一些缺失的依赖关系,经过大量的研究,在我的案例中,结果是来自旧的maven 1存储库与传统布局。 Maven 3 hates these and will burst burst into cry when it finds them. Maven 3讨厌这些并且在发现它们时会爆发出来。

So maven 2 works just fine on the command line, but maven 3 does not. 所以maven 2在命令行上运行得很好,但是maven 3没有。 The problem with eclipse is that even if you specify maven 2 as the installation to build your projects, it uses maven 3 (the embedded installation) for dependency resolution, so if you are so unlucky to require a legacy repository you are screwed (I mean, eclipse won't help). eclipse的问题在于,即使你指定maven 2作为构建项目的安装,它也会使用maven 3(嵌入式安装)进行依赖性解析,所以如果你不太需要一个遗留存储库你就搞砸了(我的意思是,eclipse也无济于事。

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

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