Error formatting macro: pagetree: java.lang.NullPointerException
Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

Current clojure-maven-plugin

  • Source at
  • Good enough for current Clojure development
    • Deployed to Maven Central
    • Written in Java
    • Does not depend on any specific version of Clojure
    • Handles different JDK versions with the Maven toolchain API
    • Handles different operating systems fairly well
  • Not so good
    • Not developed under the Clojure CA
      • May be unable to get permission from all contributors
    • Tries to do many things
      • compile, test, swank, nailgun, gendoc, autodoc, etc.
    • Forks a new Java sub-process on every execution
    • Confusing configuration variables
    • Bad defaults
      • AOT-compile everything

What do we need?

  • Essential tasks for building & releasing Clojure projects with Maven
    • AOT-compile
    • Run tests
    • Add Clojure sources to a JAR
  • Useful features for developers
    • Automatic namespace discovery from .clj sources
    • Run a REPL, possibly with wrappers like readline
    • Run a SWANK server
    • Run a Nailgun server
    • Execute arbitrary Clojure code with the project's dependencies on the classpath
  • The ideal
    • Generic way to execute Clojure code during a Maven build
    • With declarative configuration syntax for common tasks


  • Use maven-exec-plugin
    • Supports running any Java class in-process or forked
    • Manages project classpath / dependencies
    • Using it makes the build more script-like, less declarative
  • Use maven-antrun-plugin
    • Supports anything Ant can do
    • Even more flexible than maven-exec-plugin
    • Even more script-like
  • Create a plugin that calls maven-exec-plugin
    • BUT Maven plugins may not depend on other plugins

What do other JVM languages do?

  • Scala Maven Plugin
    • add-source goal to add
    • compile and testCompile goals
    • "continuous compilation" goal (infinite loop, compiles on file save)
    • "continuous testing" goal
    • "console" goal starts a REPL
    • "run" goal supports multiple configurations with different main class and arguments
  • JRuby Maven Plugin
    • Still "alpha" as of "Last Published: 07/06/2006"
    • See also JRUBY-434
  • GMaven (Groovy)
    • Includes a Maven archetype for Groovy projects
    • Allows shell-style glob to select files to compile
  • maven-jython-plugin
    • Executes Jython as a sub-process