dev.clojurephant.clojure
Base Clojure Support
Applies the dev.clojurephant.clojure-base plugin.
Java Support
Applies the Gradle built-in java
plugin to get convention-based support for the JVM ecosystem.
The high-level features of the java
plugin are:
-
Creating a
main
source set for your production code -
Creating a
jar
task that packages themain
source set’s output -
Creating a
test
source set for use with JUnit testing-
The
test
source set depends on themain
source set’s output (i.e. Java classes) -
Creates a
test
task to execute the tests
-
Full Project Layout
settings.gradle build.gradle src/ main/ clojure/ java/ resources/ test/ clojure/ java/ resources/ dev/ clojure/ java/ resources/
Main Source
By default the main
build runs with build.checkAll()
. This will let you know if any of your code is invalid and would fail a compile (without producing AOT classes).
Test Source
By default the test
build runs with build.aotAll()
since the only reliable way to run Clojure tests via Gradle’s native Test
task is to have them pre-compiled into class files.
Development Source
Its conventional in Clojure/ClojureScript projects to have a set of development-only source code, typically for use in a REPL environment.
The convention plugins create a new SourceSet named dev
to house this code. The dev
source sets’s dependency "buckets" extend from the test
and main
ones, avoiding the need to repeat declaring dependencies.
Compile Classpath
-
Clojure/ClojureScript source from the
test
source set -
Clojure/ClojureScript source from the
main
source set -
Compiled Java classes from the
main
source set -
the source set’s
compileClasspath
configuration dependencies (which include the deps fromtest
andmain
)
Runtime (REPL) Classpath
-
Clojure/ClojureScript source from the
dev
source set -
Clojure/ClojureScript source from the
test
source set -
Clojure/ClojureScript source from the
main
source set -
Compiled Java classes from the
main
source set -
the source set’s
compileClasspath
configuration dependencies (which include the deps fromtest
andmain
) -
sources
andjavadoc
JARs of all dependencies (where available) — this can be used by editor’s like CIDER to help with navigate to source or documentation -
nrepl
configuration dependencies (the nREPL server and any "jacked-in" dependencies)
REPL Task
Creates a ClojureNRepl task (named clojureRepl
) to provide an nREPL server using the dev
runtime classpath.