resolve dependencies for a single clj file.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
Makefile
README.md
oneclj.clj
sample.clj

README.md

oneclj

(note, try boot, it's better)

resolve dependencies for a single clj file.

motivation

Like lein-oneoff, I want a simple way to get dependencies and run a single clj file.

Once I put dependencies to the top of the clj file (start with ;;[):

;;[clj-time "0.11.0"]
;;[clj-http "3.1.0"]
;;[org.clojure/core.async "0.2.374"]

I can run ./bin/oneclj-deps sample.clj to generate a bash script includes resolved classpath.

requirement

java, lein and make, binaries need be found in PATH environment variable.

build

A CLOJURE variable is required:

$ CLOJURE=/opt/clojure-1.8.0.jar make

The version of clojure is also be added as dependency.

usage

Following uses sample.clj as example:

$ /path/to/oneclj-deps sample.clj

Two bash scripts are generated:

Run clj script with:

$ ./run-sample

The other one is for repl:

$ ./repl-sample

If you have rlwrap in your PATH, will also include a (oneclj-rlwrap-completions) function for writing rlwrap completion list.

The repl bash script does not load the clj file when starting.

uberjar

The Makefile also generates an oneclj-uberjar bash script.

for example:

$ /path/to/oneclj-uberjar sample.clj

creates sample-0.1.0-standalone.jar with all dependencies (fat-jar), which can be run anywhere with java -jar /path/to/sample-0.1.0-starndalone.jar.

maven branch

This project was started with the maven approach, kept in maven branch.