Fork me on GitHub
#leiningen
<
2016-05-06
>
vipaca00:05:33

I'm trying to write a plugin that uses lucene, but it seems that leiningen already includes a version of lucene. How do I avoid these dependency conflicts in a plugin and use my intended version?

danielcompton03:05:08

@vipaca not sure if you can, Leiningen is distributed as an uberjar, and I don’t think you can put stuff ahead of it on the classpath (and that might be a bad idea)

vipaca04:05:21

Looks like https://github.com/jaley/cloc does this by using leiningen.core.eval/eval-in-project except not in the invoking project, but rather a project of its own with cloc as the only dependency.

vipaca04:05:44

In that way its grabs invoking project's details then isolates from that project and leiningen via separate subprocess.

danielcompton04:05:11

Oh forgot Lucene is Java. You could use Maven Shade to do the same thing there

danielcompton04:05:23

Or maybe mranderson supports Java too, not sure

vipaca04:05:51

I was thinking that mranderson would be good for what https://github.com/jonase/eastwood ends up doing which is very simliar.

vipaca04:05:10

Its has a tool to move/inline deps to avoid collision with leiningen deps.

noprompt19:05:53

is there any way to specify where or how extra files are to be added to a jar? :filespecs is close to what i want but it's off in that if i say {:type :paths ["foo/" "bar/"]} instead of adding foo/ and bar/ it adds the contents of foo/ and bar/ to the root of the jar. what i want is to say put foo/ and bar/ at the root of the jar.

darwin20:05:47

@noprompt: I would add a lein alias command for packaging jar and there I would do a bash script which would copy contents in the way and shape as needed and then call jar task operating on that dir as :source-paths or something along those lines

darwin20:05:36

usually I use lein-shell to add shell command to my project.clj

darwin20:05:15

also somewhat related hint: to override/wrap “standard” lein task, with a shell script which then calls back to perform standard implementation, I use this trick in profiles: https://github.com/binaryage/dirac/blob/9fbc3ebb142307e2d527ca496b96ed768e0e1641/project.clj#L338 then I can freely override for example “jar” task with my own alias, and call back original via lein with-profile +nuke-aliases jar ugly, but does the job

noprompt20:05:15

@darwin: haha, i was hoping it wouldn't come to that. simple_smile

noprompt20:05:41

that being said, i'm thinking i might just go that route since it's looking dire elsewhere.

noprompt23:05:41

@darwin: i actually ended up going with the maven assembly plugin and doing lein pom && mvn install.