badunk
badunk

Reputation: 4350

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.

Upvotes: 6

Views: 4454

Answers (2)

khmarbaise
khmarbaise

Reputation: 97389

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

Upvotes: 3

Michał Kalinowski
Michał Kalinowski

Reputation: 17933

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.

Upvotes: 6

Related Questions