Personally, I'd stay away from using Maven directly despite being the accepted answer. Here is the simple Leiningen project definition which:
- generates Java sources from ANTLR4 grammar (as a bonus);
- compiles Java sources;
- compiles Scala sources (I prefer to use Scala on top of generated ANTLR4 Java code since it's much more concise and pleasant to work with);
- continues with Clojure stuff.
(defproject polyglot "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:plugins [[lein-antlr4 "0.1.0-SNAPSHOT"]
[lein-scalac "0.1.0"]]
:dependencies [[org.clojure/clojure "1.5.1"]
[org.antlr/antlr4 "4.0"]
[org.scala-lang/scala-library "2.10.1"]]
:warn-on-reflection true
:antlr4-source-paths ["antlr4"]
:antlr4-options {:package "parser" :listener true}
:antlr4-compile-path "target/antlr4/parser"
:java-source-paths ["target/antlr4/parser" "src/java"]
:scala-source-path "src/scala"
:prep-tasks ["antlr4" "javac" "scalac" "compile"])
To use ANTLR4 plugin download and 'lein install' the lein-antlr4 plugin. If you don't need it, just remove relevant lines from the project definition.
To use Scala plugin I needed to download it and change
[org.scala-lang/scala-compiler "2.9.1"]
to
[org.scala-lang/scala-compiler "2.10.1"]
in plugin's project.clj, then 'lein install' it locally. With older dependency version I was getting
java.lang.Error: typeConstructor inapplicable for <none>
from Scala compiler.