Java项目目录结构约定 [英] Java project directory structure convention

查看:101
本文介绍了Java项目目录结构约定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在目录结构中使用的maven项目:

I have worked on maven projects in which the directory structure looks like:

src/
  main/
    java/
  test/
    java/

我想知道存在其他目录结构约定。这个惯例是特定于maven的还是适用于所有的Java?我有一个需要多种编程语言的项目,并且对某些标准是否存在很好奇。

I was wondering if other directory structure conventions exists. Is this convention maven-specific or is it applicable to all of Java? I have a project that requires multiple programming languages and was curious about whether some standard exists.

推荐答案

它是Maven特定的约定目录结构,但是它甚至在Maven世界之外变得非常受欢迎,因为它是好的(像任何其他有意义的约定),没有理由不用Ant管理的项目或只是常规的Java项目使用它。即使Java项目的性质也不是必需的。例如, FlexMojos 项目可以让Flex项目由Maven管理。

It is Maven-specific convention of directory structure, however it's become quite popular even outside the Maven world, since it is good (like any other convention that makes sense) and there is no reason why not use it with Ant-managed project or just regular Java project. Even Java nature of the project is not needed. For example, there is FlexMojos project that enables Flex projects to be managed by Maven.

如果您打算使用许多编程语言,则必须使用一些扩展Maven功能的附加插件。例如,您可以使用 GMaven 插件在Maven项目中启用Groovy语言支持。然后,将Groovy源放入 src / main / groovy 中的约定(实际上是默认的插件设置)。默认情况下,只支持Java。

If you plan to use many programming languages, you have to use some additional plugins that extend Maven capabilities. For example, you can use GMaven plugin to enable Groovy language support in Maven project. Then, there is convention (in fact: default setting of plugin) to put Groovy sources into src/main/groovy. By default, only Java is supported.

这篇关于Java项目目录结构约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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