在Maven项目中,嵌套目录或平面目录布局的原因是什么? [英] In a Maven project, what are reasons for either a nested or a flat directory layout?

查看:98
本文介绍了在Maven项目中,嵌套目录或平面目录布局的原因是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着我的Maven项目的发展,我试图保持在项目结构的顶部.到目前为止,我具有2-3个级别的嵌套目录布局,其中每个级别都有一个POM,其中带有module条目,对应于该级别的目录. POM继承(parent属性)不一定紧随其后,并且与该问题的目的无关.

现在,虽然嵌套结构对于Maven来说似乎很自然,而且只要处于一个特定级别,它就干净整洁,但我开始对自己在IDE(Eclipse和IntelliJ IDEA)中看到的内容感到困惑).

我看了一下Apache Felix的源代码,他们有一个相当复杂的项目,似乎是一个平面目录结构,所以我想知道这是否是更好的方法.

您在实践中遇到的两种方法都有哪些利弊?

请注意,其中此问题(其中我发现与此同时)似乎非常相似.我将其留给社区来决定是否应将其作为重复项关闭.

解决方案

我使用一种混合方法.具有不同生命周期的事物(从发行版和VCS的角度来看)是平坦的,具有相同生命周期的事物是嵌套的.我使用svn:externals进行结帐.我在以前的答案中写了这种方法.. >

As my Maven project grows, I'm trying to stay on top of the project structure. So far, I have a nested directory layout with 2-3 levels, where there's a POM on each level with module entries corresponding to the directories at that level. POM inheritance (parent property) does not necessarily follow this, and is not relevant for the purpose of this question.

Now, while the nested structure seems pretty natural to Maven, and it's nice and clean as long as you are on one particular level, I'm starting to get confused by what I look at in my IDE (Eclipse and IntelliJ IDEA).

I had a look at the Apache Felix sources, and they have a pretty complex project in what seems to be a flat directory structure, so I'm wondering if this would be a better way to go.

What are some pros and cons for either approach that you have experienced in practice?

Note that this question (which I found meanwhile) seems to be very similar. I'll leave it to the community to decide whether this should be closed as a duplicate.

解决方案

I use a kind of mixed approach. Things with distinct lifecycle (from a release and thus VCS point of view) are flat, things with the same lifecycle are nested. And I use svn:externals for the checkout. I wrote about this approach in this previous answer.

这篇关于在Maven项目中,嵌套目录或平面目录布局的原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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