clojurephant

Formerly known as "gradle-clojure"

Bintray cljdoc

What is this?

A Gradle plugin providing support for the Clojure and ClojureScript languages.

NOTE: clojurephant should not be considered stable until 1.0.0. Until then, minor versions (e.g. 0.1.0 to 0.2.0) will likely contain breaking changes.

Clojure Features

ClojureScript Features

NOTE: ClojureScript features are pretty new, so let us know if you run into issues or have ideas for improvement.

Why should you care?

The goal is to provide the same creature comforts that Leiningen and Boot do for Clojure/ClojureScript development, while also leveraging Gradle's unique features:

Usage

See the Release Notes for available versions, compatibility with Gradle, Java, and Clojure, and detailed change notes.

This plugin assumes you're using a sane layout for your Clojure code - namespaces corresponding to your source code layout, and one namespace per file. The plugin uses the filenames to calculate the namespaces involved, it does not parse the files looking for ns forms.

Quick Start

Create a new Clojure library:

clj -A:new gradle-clj-lib myname/mylib

Create a new Clojure application:

clj -A:new gradle-clj-app myname/myapp

Create a new ClojureScript appliation:

clj -A:new gradle-cljs-app myname/myapp

Common Commands

build.gradle

plugins {
  id "dev.clojurephant.clojure" version "<version>"
}

// You need to add clojars for the plugin to work.
repositories {
  maven {
    name = 'Clojars' // name can be ommitted, but is helpful in troubleshooting
    url = 'https://repo.clojars.org/'
  }
}

dependencies {
  // whatever version of clojure you prefer (versions before 1.8.0 may not be compatible)
  implementation 'org.clojure:clojure:1.10.0'
  // and any other dependencies you want on the compile classpath
  // implementation 'group:artifact:version'

  // needed for test integration
  testImplementation 'junit:junit:4.12'
  // and any other test-specific dependencies
  // testImplementation 'group:artifact:version'

  // dependencies for REPL use only
  devImplementation 'org.clojure:tools.namespace:1.0.0'
}

See all available options in the docs.

Getting help

Read the online Clojurephant documentation https://clojurephant.dev.

For questions or support, please visit either the ClojureVerse gradle-clojure channel or the Clojurian's Slack #gradle channel

For bug reports and feature requests, please use the repo's issues.

Contributing

See the guidelines for details on how you can contribute.

Acknowledgements

This project started from the cursive.clojure plugin by Colin Fleming (@cmf, original author) and Piotrek Bzdyl (@pbzdyl).

Thanks to John Szakmeister (@jszakmeister) for organizing a call with Gradle to get us started in the right direction.

Thanks to all our contributors.