Skip to content

emrantalukder/sbt-clojure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sbt-clojure

Usage

  • add plugin to project/plugins.sbt
lazy val clojurePlugin = RootProject(uri("https://github.com/terminally-chill/sbt-clojure.git"))
lazy val root = (project in file(".")).dependsOn(clojurePlugin)
  • enable plugin in build.sbt
lazy val root = (project in file("."))
  .enablePlugins(ClojurePlugin)
  • create clojure source directory at src/main/clojure

Interop Example:

  • interop.clj to be invoked from scala source
(ns com.terminallychill.clj.interop
  (:gen-class :methods [#^{:static true} [info [] void]
                        ^:static [get [String] String]
                        ]))
;; static methods
(defn -info []
  (println "[x] clojure version: " (clojure.core/clojure-version)))

(def foo-map {:a "a" :b "b" :c "c"})

(defn -get [key]
  (foo-map (keyword key)))
  • Main.scala will call get and info functions
import com.terminallychill.clj._

object ClojureInterop extends App {
  // static clojure method:
  interop.info()

  // reads from clj data structure:
  val v = interop.get("a")
  println(v)
}

About

clojure compiler for sbt

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages