Fork me on GitHub
Charles Fourdrignier09:10:59

I've got a very naive question. I build an uberjar with AOT and I would like to exclude my own sources from the jar. I don't find an option for that in depstar. Is it possible ? I mean, even if not possible with the current state of the tool, is it 'correct' ? Or did the jar needs the sources, for a reason I don't know ?


@charles.fourdrignier The latest depstar has an option to exclude files via regex so you could use that to filter out your own project's code but I would ask why you want to? AOT in depstar is transitive from the entry namespace you specify but it's possible to have code that isn't statically reachable from your -main namespace but is still reachable dynamically (if you have any runtime require, for example) -- and in that case you would still need some sources in the JAR.

Charles Fourdrignier19:10:39

If I understand correctly, by excluding a file I exclude not only the source, but the whole code. (Useful if I want to deploy in a context already containing some dependencies.) Correct ? For the "why", I want to distribute a jar allowing execution of a "closed source" project (not something super secret, but not expected to be open sourced). Thank you for the response. More than a solution to that problem, I wanted to understand the reason behind sources inclusion. Now, it's super clear.


The compile happens first, then the copying. So if you use a regex that excludes just the source of your own files, their compiled versions would still be copied.


You would need to be careful with your regex, so you don't accidentally exclude other source files in the libraries you depend on (so "\.clj$" is too broad).

Charles Fourdrignier19:10:10

Ok, I will try this.

Charles Fourdrignier08:10:44

Works perfectly ! In my previous try, I misunderstood the pattern and exclude my whole namespace not only my clj files. 🙂


Unless you have some very specific reason for not including your source in the uberjar, I wouldn't spend any effort making that happen, in my opinion.