0

From https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html I can see that there is a directory /src/main/java .

Why do we need a directory named java here? Do we have another programming langeage within a java project?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
guo
  • 9,674
  • 9
  • 41
  • 79
  • You might. `scala` for example. But you should (or could) also have a `/src/main/resources`. – Elliott Frisch Oct 28 '16 at 03:30
  • 1
    Scala, Groovy, Kotlin, etc JVM based languages that Maven could compile – OneCricketeer Oct 28 '16 at 03:35
  • 'Do we have another programming langeage within a java project?'. Your question is mis-phrased. It should be 'Do we have another programming langeage within a *Maven* project?', and the answer is yes, Java is only one of many possible choices. – user207421 Oct 28 '16 at 04:06
  • 2
    You also have non-language directories, e.g. `/src/main/resources`, `src/main/webapp`, ... Since there are multiple directories, the one with the Java source code needs *some* name, so why not `java`, even if other languages weren't possible? – Andreas Oct 28 '16 at 04:27

1 Answers1

0

Why do we need a directory named java here?

To allow for other languages.

Do we have another programming language within a java project?

Potentially yes. Systems with components written in multiple languages are common. There is no insurmountable technical reason why Maven should / could not also build the non-Java components, especially when the languages can be compiled to bytecodes.

By specifying a location for Java source code, the Maven designers have (at least) avoided future problems.

UPDATE

Indeed, this is not hypothetical:

Another use-case is for the input files for generators / translators such as idlj and javacc.

Community
  • 1
  • 1
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216