lein-jlink icon indicating copy to clipboard operation
lein-jlink copied to clipboard

Assemble can fail every time

Open Vaelatern opened this issue 3 years ago • 4 comments

On my version of lein, 2.9.5 on Java 11.0.9, the following call ends up removing the target/image directory.

https://github.com/sunng87/lein-jlink/blob/master/src/leiningen/jlink.clj#L139-L141 (The first two lines are useless and can be removed without ill effect).

As such, when the call is made to copy the uberjar to the target destination, on line 144, the target directory might no longer exist.

This causes problems, since the java process being used is also in the target directory (when the middleware is installed).

I'm trying to fix it for myself, will report back, but suggestions would be helpful too.

Vaelatern avatar Apr 23 '21 02:04 Vaelatern

https://github.com/technomancy/leiningen/blob/master/src/leiningen/jar.clj#L339-L340

Vaelatern avatar Apr 23 '21 15:04 Vaelatern

Thanks for your investigation. Could you please send a pull request for this?

sunng87 avatar Apr 24 '21 02:04 sunng87

I suspect it should be a documentation fix, or maybe there is a way to make sure clean doesn't get target/image. Since I don't have a generalizable solution yet, I'll leave this issue open and PR when I find a fix

Vaelatern avatar Apr 25 '21 02:04 Vaelatern

I suspect it should be a documentation fix, or maybe there is a way to make sure clean doesn't get target/image. Since I don't have a generalizable solution yet, I'll leave this issue open and PR when I find a fix

This is not a bug, it's a feature :). You may omit this behaviour by setting :auto-clean value to false for your project.clj. Additional information here @Vaelatern @sunng87

drzsda avatar Jul 08 '22 08:07 drzsda