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

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

问题描述

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

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

在eclipse中,我有项目Foo包含在项目中Bar的构建路径,以便我可以使用项目Bar中的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到项目Bar的类路径中,但据我所知,在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-> build path引用其他项目。只要您使用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天全站免登陆