Maven通过中间pom文件拉取依赖关系 [英] Maven pull dependencies via middle pom file

查看:229
本文介绍了Maven通过中间pom文件拉取依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 在Maven中有可能依赖于jar1和jar2,但是通过中间的pom文件建立这种依赖关系: mypom.xml  - > middle_pom.xml  - > jar1,jar2 

可以这样做吗?



当然,mypom.xml的包装是我想要的war,但是middle_pom.xml的包装将是pom,同意?

解决方案

正如你所说,打包为middle_pom pom ,然后只需添加一个依赖关系到这样的mypom.xml:

 <依赖关系> 
< groupId> com.my.group< / groupId>
< artifactId> middle_pom< / artifactId>
< version> 0.1< / version>
< type> pom< / type>
<依赖关系>

虽然如果你解释你想做的这个原因,有人可能会给你一个更有帮助建议。


In Maven is it possible to depend on jar1 and jar2 but establish this dependency via a middle pom file like so:

mypom.xml --> middle_pom.xml --> jar1, jar2

Can this be done in that way?

Of course the packaging for mypom.xml is whatever I want like 'war' but the packaging for middle_pom.xml would be 'pom', agree?

解决方案

As you say, make the packaging for middle_pom pom, then just add a dependency to mypom.xml like so:

<dependency>
    <groupId>com.my.group</groupId>
    <artifactId>middle_pom</artifactId>
    <version>0.1</version>
    <type>pom</type>
<dependency>

Though if you explain the reason you want to do this someone might be able to give you a more helpful suggestion.

这篇关于Maven通过中间pom文件拉取依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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