maven 适合这种情况吗?

发布于 2024-09-16 14:36:02 字数 686 浏览 2 评论 0原文

我们目前有一个基于 ant 的项目,正在考虑迁移到 Maven。 该项目基于 java ee,但它具有模块结构,其中每个模块可以包含多个 java ee 项目。像这样:

mod1-->subdir-->war-A
             -->war-B
mod1->src
mod1->build/classes

添加多个此类模块以及一些 jar 依赖项,并创建一个 EAR 文件。 自定义清单文件

+像这样的

EAR -->war-A
    -->war-B
    -->war-C
    -->war-D
    lib/allclasses-from-allmodules-in-one jar

这个结构和依赖项无法更改 - 它来自我们使用的框架。

我对 Maven 的了解不够,无法弄清楚这需要多少工作——或者我们的项目结构和开发实践是否与 Maven 约定相去甚远,以至于不值得花时间。

我意识到你可以让 Maven 做任何你想做的事 - 但如果我们做出改变,应该是为了 Maven 的好处,而不是让生活变得更困难! :)

另一件重要的事情是我希望能够创建分解的ear文件...我需要哪些选项来自定义该方面?如果我进行定制的“任务”,我会放弃什么(我不确定这个的行家术语是什么)

We currently have an ant based project and are contemplating moving to maven.
The project is java ee based, however it has a module structure where each module can contain multiple java ee projects. like this:

mod1-->subdir-->war-A
             -->war-B
mod1->src
mod1->build/classes

multiple such modules plus some jars dependencies are added and one EAR file is created.
+ custom manifest file

like so

EAR -->war-A
    -->war-B
    -->war-C
    -->war-D
    lib/allclasses-from-allmodules-in-one jar

This structure and dependencies cannot be changed- it comes from a framework that we use.

I don't know enough about maven to figure out how much work this is- or if our project struture and development practices are so far removed from the maven convention that its not worth the time.

I realize you can bend maven to do whatever you want it to -but if we make a switch it should be for the benefits of maven not to make life harder! :)

The other important thing is that I want to be able to create the ear file exploded...what options do I have to customize that aspect ? What will I be giving up if I go with a customized "task" (I'm not sure what the maven term for this is)

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

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

发布评论

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

评论(2

眉目亦如画i 2024-09-23 14:36:02

老实说,我不会费心将其移植到 Maven - 尽管我是一个十足的 Maven 粉丝,但我还是这么说。将构建时具有任何复杂性的完整项目转换为 Maven 通常不值得您经历这样的麻烦。

对于新项目或者可能重写这个应用程序(如果它发生的话),我完全建议从 Maven 开始。

我意识到你可以让maven去做
不管你想要什么——但是如果我们
进行切换应该是为了
maven的好处不在于让生活
更难! :)

你可以“让行家”做任何你想做的事,但通常你这样做是搬起石头砸自己的脚。 maven 的要点在于它是按约定构建,而不是按配置构建。您越冒险去做超出 Maven 生命周期范围的事情,您在构建的维护和可靠性方面就会遇到更多麻烦。

To be perfectly honest, I wouldn't bother with porting this over to maven - and I say this despite being a total maven fanboy. Converting full projects that have any kind of complexity at build time to maven normally isn't worth the trouble you'll undergo.

For new projects or perhaps a rewrite of this app (if it were to ever happen), I would fully suggest starting with maven instead.

I realize you can bend maven to do
whatever you want it to -but if we
make a switch it should be for the
benefits of maven not to make life
harder! :)

You can "bend maven" to do whatever you want, but typically you are shooting yourself in the foot when you do so. The point of maven is that it's a build by convention, not by configuration. The more you venture outside of doing things that fall outside of the scope of the maven lifecycle, the more trouble you are asking for in terms of the maintenance and reliability of your build.

怪我太投入 2024-09-23 14:36:02

我不能 100% 确定我理解您当前的项目结构,但如果您无法更改任何内容,那么似乎存在重大问题。使用 Maven:

  1. 嵌套模块的父模块不包含代码
  2. 一个模块仅生成一个主要工件(但不确定是否是您的项目的情况)

与上述问题相比,不遵循 Maven 默认布局是一个小问题。

如果没有更多关于可以更改的内容(不破坏结构)的详细信息,我只是认为它无法以优雅的方式实现(如果甚至可行)。

I'm not 100% sure I understood your current project structure but if you can't change anything, it looks like there are major show stopper issues. With Maven:

  1. parent modules of nested modules don't contain code
  2. one module produces only one main artifact (not sure it's the case of your project though)

Not following the Maven default layout being a minor problem compared to the above one.

Without more details about what can be changed (without breaking the structure), I simply don't think it's doable in an elegant way (if even doable).

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