make lein uberjar without source files
Asked Answered
M

2

13

I'm using 'lein uberjar' to make a executable jar file of my project. the jar is created correctly and runs as expected.

I just want to know if it is possible to NOT include my source .clj files in the generated .jar, since I'm planning to distribute it, and I don't want my source files available to the public.

I'm using lein 1.7.1

if not possible with lein, would it work if I just manually removed the .clj files from the jar? I did a test and it worked, by I want to be sure that this is safe to do.

thanks in advance.

Muna answered 25/5, 2012 at 18:6 Comment(0)
B
13

Use :omit-source true in lein's project.clj.

Brethren answered 27/5, 2012 at 0:15 Comment(0)
G
2

Have you tried using the aot compilation step that is provided? See here for an example.

Also, someone blogged something not too long ago about aot compiling their entire project: http://blog.japila.pl/2012/02/aot-compile-all-namespaces-in-a-clojure-project-aot-all-in-project-clj-leiningen/

In that case, too, you might still have to dig in and remove the .clj files, I'm not sure. Maybe this is somewhere to start, though.

Edit 1

I should note that even if you were to use compilation to just distribute the .class files, there are really good tools to decompile those classes in a way that users can read (I've used this in the past when the documentation was so poor I had to look elsewhere to see how it worked).

In those cases, you'd be better off finding a way to implement your own code obfuscator, although I know little/nothing about that topic, here's a start.

Globate answered 25/5, 2012 at 18:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.