Maven2:是否可以部署取决于工件分类器?

发布于 2024-11-27 05:39:51 字数 670 浏览 1 评论 0原文

事实上,我有两个不同的问题,但我认为它们有点相关:

  1. 我有一个工件,带有一个程序集描述符集,它将构建一个额外的 JAR(带有额外的分类器)。默认情况下,Maven2/3 将部署与主工件一起生成的程序集以删除 Maven 存储库。有什么方法可以让我只部署主工件而不部署程序集?

  2. 我有一个工件,其中我有 jar 插件生成另一个具有不同分类器的工件(更具体地说,一个 EJB 工件,并且我生成一个客户端 JAR)。我只想将客户端 JAR 部署到 Maven 存储库,因为我认为主要的 EJB 工件不会真正被其他项目共享。可以这样做吗?

非常感谢


编辑提供更多信息:

避免部署 EJB 的原因是因为 EJB 主要工件不会被除包含项目之外的其他项目所依赖。包含的项目将构建一个 EAR(其中包含 EJB),通常我们只需要在本地构建(通过 mvn 包)。然而,我们将把 EJB 客户端部署到我们的存储库中,以便其他项目需要与我们的应用程序通信时共享。

老实说,部署 EJB 也没有坏处,但我只是想看看是否可以在我们的存储库上节省不必要的磁盘空间浪费。

同样,对于部署程序集,这是因为我们要部署该项目以供其他项目依赖。然而,在构建该项目时,我们还同时创建了一个单独的程序集(例如,一个一体化的可执行 jar),我们只需要在本地构建它,并且其他项目不会依赖它。

In fact I have 2 different problems, but I think they are kind of related:

  1. I have an artifact, with an assembly descriptor set which will build an extra JAR (with extra classifier). By default, Maven2/3 will deploy the assembly generated together with the main artifact to remove Maven repository. Is there any way that I can deploy only the main artifact but not the assembly?

  2. I have an artifact, in which I have jar plugin generate another artifact with different classifier (more specific, an EJB artifact, and I generate an client JAR). I want to deploy only the client JAR to Maven repo coz I think the main EJB artifact is not really going to be shared by other project. Is it possible to do so?

Thanks a lot


editied to provide more info:

The reason for avoiding deploy the EJB, is because the EJB main artifact is not going to be depended by other project except the containing project. The containing project will build a EAR (which contains the EJB), and normally we only need that build locally (by mvn package). However, the EJB client is something that we will deploy to our repo to let other project share when they need to communicate with our application.

Honestly it doesn't harm to deploy the EJB too, but I just want to see if I can save unnecessary waste of disk space on our repository.

Similarly, for deploying assembly, it is because the project is something we want to deploy to let other project to depends on. However, when building that project, we also have a separate assembly created on the same time (for example, an all-in-one executable jar) which we only need that built locally, and it is not something that other projects will depends on.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

猛虎独行 2024-12-04 05:39:51

关闭程序集插件的“附加”选项。那么它就不会成为正式的工件,也不会部署;它只会潜伏在目标目录中,生闷气说你不像它的哥哥那样爱它,并策划复仇。

Turn off the 'attach' option to the assembly plugin. Then it won't be officially an artifact and it won't deploy; it will just lurk in the target directory, sulking that you don't love it as much as it's elder sibling and plot revenge.

慵挽 2024-12-04 05:39:51

根据您的第一个问题,我想知道您为什么要创建通常部署的补充程序集以及主要工件。如果您不想阻止,可以将程序集的创建放入配置文件中,但这意味着您不会仅通过激活配置文件来在通常的构建中生成补充工件。

Based on your first question i would like to know why do you create the supplemental assembly which is usually deployed as well as the main artifact. If you wan't to prevent you can put the creation of the assembly into a profile but this means you will not generate the supplemental artifact in your usual build only by activating the profile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文