Open paulbutcher opened 10 years ago
I suspect that this line is causing the issue. It should probably be :target-path
rather than :compile-path
.
That doesn't seem to be it, I'm afraid. The only difference between :compile-path and :target-path is that :compile-path has "/classes" appended. Switching to :target-path breaks things.
As far as I can work out (although I'm not at all familiar with Leiningen's internals, so I may well have this wrong), the problem seems to be that main is being compiled before the uberjar profile is merged into the project. So when main is compiled, :compile path is target/base+system+user+dev/classes
instead of target/uberjar/classes
.
I tried merging the uberjar profile before compiling main, like https://github.com/weavejester/lein-ring/pull/104 does, but that doesn't address the problem either (it just seems to confuse matters because Leiningen doesn't like having the profile merged twice).
So I'm at a loss - the only way forward I can see right now is to copy Leiningen's uberjar task and add jar/compile-main to it after the uberjar profile has been merged into the project. Eugh!
faced this issue too :(
faced this issue too :(
There is a similar problem with the ring uberwar
task.
I think this issue should be closed. On lein-ring 0.9.3 it seems to be fixed to me. Is there a particular case that can reproduce a failure? I did the following to verify (which is essentially the same case as the original report by @paulbutcher)
lein new compojure ring-116
# change lein-ring version to 0.9.3
java -jar target/ring-116-0.1.0-SNAPSHOT-standalone.jar
rm -rf target
# add target-path to project.clj
lein ring uberjar
java -jar target/uberjar/ring-116-0.1.0-SNAPSHOT-standalone.jar
lein-ring’s uberjar command seems to be incompatible with Leiningen’s profile-specific :target-path.
Generate a project with
lein new compojure foo
, build withlein ring uberjar
and run withjava -jar target/foo-0.1.0-SNAPSHOT-standalone.jar
and everything works fine.However, add this to project.clj:
And the generated uberjar (which will now be in
target/uberjar
) is missing the main class: