Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Maven source directories for a polyglot project

I have a Maven project (in Eclipse using the m2eclipse plugin) that contains code in two different languages (Java and Clojure).

Ideally I'd like two separate source folders for the two languages:

  • src/main/java
  • src/main/clj

Eclipse is happy with having two source directories defined in the project. However, as far as I can work out, Maven only supports a single source directory as follows:

<build>
  ....
  <sourceDirectory>src/main/java</sourceDirectory>
  ....
</build>

If I add a second sourceDirectory to the pom.xml, I get an error.....

Is there a recommended way to configure this kind of polyglot project in Maven?

like image 756
mikera Avatar asked Oct 20 '25 21:10

mikera


1 Answers

I don't believe you need to do that; the Clojure plugin should already know how to find Clojure source (although IIRC it defaults to src/main/clojure).

See here for some details.

like image 137
Dave Newton Avatar answered Oct 22 '25 12:10

Dave Newton