ProductPromotion
Logo

Clojure

made by https://0x3d.site

GitHub - clj-commons/virgil: Recompile Java code without restarting the REPL
Recompile Java code without restarting the REPL. Contribute to clj-commons/virgil development by creating an account on GitHub.
Visit Site

GitHub - clj-commons/virgil: Recompile Java code without restarting the REPL

GitHub - clj-commons/virgil: Recompile Java code without restarting the REPL

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.

Virgil is a library for live-recompiling Java classes from the REPL. This can be done either manually or by starting a process that watches your source directories for changes in Java files and triggering recompilation when that happens.

Usage

Add virgil/virgil dependency to your project.clj or deps.edn. If you plan to use Virgil just as a devtime dependency, then you probably want to add it to a profile/alias which you enable only during development.

(require 'virgil)
;; To recompile once, manually:
(virgil/compile-java ["src"])

;; To recompile automatically when files change:
(virgil/watch-and-recompile ["src"])

The main argument to these functions is a list of directories where Java source files are located. Both functions can accept a list of string :options that is passed to Java compiler, e.g. :options ["-Xlint:all"] to print compilation warnings, and a :verbose flag to print all classnames that got compiled.

watch-and-recompile accepts an optional :post-hook function. You can use it to, e.g., trigger tools.namespace refresh after the classes get recompiled.

Check example directory for a sample project.

Happy tarnishing.

Can I use Virgil in production?

Virgil can compile Java classes at runtime in a production environment the same way as it does during the development, so the answer is yes. However, when you do a release build, it is advised to build real Java classes explicitly during your build step using javac task of your build tool. There are multiple arguments for it:

  • You get extra reliability and assurance that the compiled Java classes will be correctly discoverable by other code.
  • You get one fewer runtime dependency.
  • You won't have to rely on JDK-specific tools like javax.tools package that might not be available in your production environment (e.g., if it runs on JRE).

Migration from 0.1.9

From version 0.3.0, Virgil no longer provides lein-virgil plugin for Leiningen. Instead, you should add virgil as a regular dependency to your project and call its functions from the REPL.

Supported versions

Virgil makes sure to support Clojure 1.10+ and JDK 8, 11, 17, 21, 22 (see CI job). Supporting future versions of Java so far required only bumping ASM library dependency, so that shouldn't take long. Please, create an issue if you run into any compatibility problems.

Publishing new releases

Releases are handled by CircleCI. All you need to do is to tag a commit with a x.y.z and push the tag.

License

Copyright © 2016-2019 Zachary Tellman, 2022-2024 Oleksandr Yakushev

Distributed under the MIT License

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory