将引用的eclipse项目添加到maven依赖项 [英] Adding referenced eclipse projects to maven dependancies

查看:493
本文介绍了将引用的eclipse项目添加到maven依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我有两个Eclipse项目 - 他们都使用Maven 2来获得所有的jar依赖性。

Right now, I have two Eclipse projects - they both use Maven 2 for all their jar-dependency goodness.

在日食中,项目中包含项目Foo酒吧的建立路径,所以我可以从项目栏使用Foo的类。这在日出的土地上工作得很好,但是当我尝试:

Inside eclipse, I have project Foo included in project Bar's build path, so that I can use Foo's classes from project Bar. This works really well in eclipse land, but when I try:

mvn compile 

在Bar的目录中,它失败,因为Maven不了解Eclipse的构建路径中的项目到项目关系。

inside Bar's directory, it fails because Maven doesn't know about the project-to-project relationship in Eclipse's build path.

如果我使用蚂蚁,我只是用它来做一些愚蠢的东西,像将foo.jar拷贝到项目栏的类路径中,但据我所知,在Maven中,事情做得更少了-land。

If I were using ant, I would just use it to do something silly like copy foo.jar into project Bar's classpath, but as far as I can tell, things are done a lot less hackishly in Maven-land.

我想知道是否有一个标准的解决方法,这种类型的问题 - 似乎这是相当普遍的,我只是错过了一些基本的关于Maven如何工作。

I'm wondering if there's a standard workaround for this type of problem - it seems like it would be fairly common, and I'm just missing something basic about how Maven works.

推荐答案

也许您只是通过eclipse configure->构建路径引用另一个项目。只要您使用Eclipse来构建项目,就可以使用。

Maybe you are referencing the other project via eclipse configure-> build path only. This works as long as you use Eclipse to build your project.

尝试在项目栏中运行第一个mvn install(以便将Bar放入您的maven仓库),然后添加依赖关系到Foo的pom.xml。

Try running first mvn install in project Bar (in order to put Bar in your maven repository), and then add the dependency to Foo's pom.xml.

应该可以工作!

这篇关于将引用的eclipse项目添加到maven依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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