Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java project directory structure convention

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

src/
  main/
    java/
  test/
    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.

like image 588
badunk Avatar asked May 14 '12 20:05

badunk


2 Answers

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.

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.

like image 192
Michał Kalinowski Avatar answered Oct 27 '22 00:10

Michał Kalinowski


The convention is to follow the default folder layout in Maven. Furthermore other programming language follow those conventions like src/main/c++ etc.

like image 36
khmarbaise Avatar answered Oct 26 '22 23:10

khmarbaise