Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Clojure interfaces in a Java library project

I would like to use some of the Clojure interfaces in a Java library project in several situations where it would be useful for my Java classes to implement them. In particular:

  • clojure.lang.ISeq
  • clojure.lang.IFn

Doing this would make my Java library much more user-friendly for Clojure-based users.

However I don't want to import the whole of clojure.jar as a dependency - since it is relatively large and my library is mainly targeted at Java users.

Is there a way to import and develop against the Clojure interfaces without bringing in the rest of Clojure?

like image 531
mikera Avatar asked Oct 06 '22 01:10

mikera


1 Answers

Try it:

  1. unpack the clojure jar
  2. put only the .class you need into a directory named LightweightClojure
  3. run you test appli (test + lib + LightweightClojure)
  4. goto 2 until it works
  5. zip the LightweightClojure directory into LightweightClojure.jar
like image 152
Aubin Avatar answered Oct 10 '22 03:10

Aubin