行家:生成几个“工件"使用相同的pom文件? [英] maven: generating several "artifacts" with a same pom file?

查看:74
本文介绍了行家:生成几个“工件"使用相同的pom文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目此处,该项目目前使用一个pom.xml(链接)以生成一个工件".

I have a project here which, currently, uses one pom.xml (link) to generate one "artifact".

我想做的就是将项目拆分为p,将其命名为:

What I'd like to do is split the project, let's call it p, into:

  • p-core,其中包含核心验证过程;
  • p-format,其中包含"format"关键字验证,该验证取决于p-core.

我要这样做的原因是依赖关系:p格式仅在卷中就吸引了70%以上的文件,而且对JSON Schema的使用很少需要格式支持.

The reason I want to do this is dependencies: p-format pulls in more than 70% of them in volume alone, and not many uses of JSON Schema require format support anyway.

我需要构建两个完全独立的项目,还是可以使用一个pom.xml生成这两个工件?我想后者是可行的,因为许多项目已经做到了(例如,杰克逊).

Do I need to build two entirely separate projects, or can I use one pom.xml to generate these two artifacts? I guess the latter is doable, since lots of projects already do that (Jackson, for example).

[如果有任何重要性,我会通过Sonatype的Maven回购发布]

[In the event that it would have any importance, I publish via Sonatype's maven repo]

推荐答案

您应该创建两个分离的项目(两个分离的POM),但是一个好主意是为它们创建公共父级,并将它们聚合为模块.查看Project Inheritance 和 Project Aggregation 部分. html"rel =" noreferrer> POM简介以了解一些基础知识.

You should create two separated projects (two separated POMs), but probably a good idea would be to create common parent for them that also aggregate them as modules. Look at Project Inheritance and Project Aggregation sections of Introduction to the POM for some basics.

在Maven中,尝试对其进行破解从来都不是一个好主意,因此它会从一个POM中产生许多不同的工件.

In Maven, it's never a good idea to try to hack it so it produces many different artifacts from one POM.

这篇关于行家:生成几个“工件"使用相同的pom文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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