简体   繁体   English

Maven自包含的儿童神器

[英]Maven self-contained child artifact

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. 我有一个项目,其中包含3个pom文件:父文件(非常基本的文件,只声明其子级),用于构建项目本身的主pom和用于生成swagger客户端库的pom文件。 The client artifact is getting downloaded into our Nexus. 客户端工件已下载到我们的Nexus中。

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. 我不想将其下载到Nexus,因为它非常基础,只会充斥整个存储库。 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. 我试过打包某种uber-jar,但对我而言不起作用-jar很大,包含所有依赖项,但仍需要父产品。 Are there any workarounds? 有什么解决方法吗?

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 虽然我通常不希望在存储库中有一个附加的Parent POM(我们的存储库包含2000个不同版本的自行创建的工件,但不是“泛滥”的),您可以看一下

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

which allows you to make your pom smaller, and includes the possibility to get away without a Parent POM. 这可以使您的pom变小,并且可以在没有父POM的情况下逃脱。

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

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