Maven自包含的儿童神器 [英] Maven self-contained child artifact

查看:223
本文介绍了Maven自包含的儿童神器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含3个pom文件的项目:父文件(非常基本的一个,只是声明了它的子对象),用于构建项目本身的主pom和用于生成swagger客户端库的pom文件.客户端工件已下载到我们的Nexus中.

I have a project which has 3 pom files: parent file (very basic one, just declares its children), main pom for building project itself and a pom file for generating swagger client library. The client artifact is getting downloaded into our Nexus.

问题是,当我想在另一个项目中使用客户端库作为依赖项时,它还需要一个父工件.我不想将其下载到Nexus,因为它非常基础,只会充斥整个存储库.我试过打包某种uber-jar,但对我来说不起作用-jar很大,包含所有依赖项,但它仍需要父产品.有什么解决方法吗?

The problem is that when I want to use a client library in another project as a dependency it also requires a parent artifact. I don't want to download it into Nexus since it's so basic and will only flood the repository. I've tried packing some kind of an uber-jar, but it doesn't work for me - jar is huge and contains all dependencies, yet it still needs parent artifact. Are there any workarounds?

推荐答案

虽然我通常不希望在存储库中有一个附加的Parent POM(我们的存储库包含2000个不同版本的自行创建的工件,但不是充斥"),您可以查看

While I generally would not care about having an additional Parent POM in the repository (our repository contains 2000 different self-created artifacts in various versions, it is not "flooded"), you can have a look at the

https://www.mojohaus.org/flatten-maven-plugin/

这可以使您的pom变小,并且包括无需父POM即可逃脱的可能性.

which allows you to make your pom smaller, and includes the possibility to get away without a Parent POM.

这篇关于Maven自包含的儿童神器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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