Skip to content
your own personal JVM psychopomp
Clojure Java
Branch: master
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.
docs image caching is hard, apparently Mar 16, 2017
lein-virgil target latest ASM, should fix #30 Jan 14, 2019
src Have compile-all-java return class->bytecode map Apr 29, 2018
test more CI tweaks Apr 4, 2018
.gitignore initial commit Nov 19, 2015
.travis.yml support jdk 9 Dec 13, 2017
README.md target latest ASM, should fix #30 Jan 14, 2019
project.clj

README.md

Do you tarnish your Clojure with the occasional hint of Java? Have you become indescribably tired of reloading your REPL every time you change anything with a .java suffix? Look no further.

In your project.clj or ~/.lein/profiles.clj, add this:

{:plugins [[lein-virgil "0.1.9"]]}

Now, as if by magic, every time the .java files on your :java-source-paths change, they will be recompiled within your REPL and all the namespaces that rely on those files will be reloaded. A helpful message will be printed out, including any compilation errors you may have introduced along the way (these are written to stdout, so they may show up in a different buffer than your REPL).

Happy tarnishing.

Boot

For Boot, add this to your build.boot:

(set-env! :dependencies '[[virgil "0.1.9"]
                          ...])

(require '[virgil.boot :refer [javac*]])

Now you have the option to run Virgil manually from the REPL. Virgil will automatically scan your :source-paths for Java files. This will compile Java classes once:

boot.user=> (boot (javac*))

Or you can enable automatic background recompilation like in lein-virgil:

boot.user=> (def f (future (boot (comp (watch) (javac*)))))
;; Then, to disable:
boot.user=> (future-cancel f)

In your build pipelines, you can continue to use the Boot's built-in javac task.

javac* task supports the following parameters:

  • :verbose — print every class name that is compiled.
  • :options — a vector of strings that is passed to Java compiler, same as to javac binary. E.g., you can use (javac* :options ["-Xlint:unchecked"]) to print additional warnings from the compiler.

license

Copyright © 2016 Zachary Tellman

Distributed under the MIT License

You can’t perform that action at this time.