technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.61k forks source link

Hitting a wall trying to package lein #2786

Closed olymk2 closed 2 years ago

olymk2 commented 2 years ago

I have built lein copying the lein script to the bin folder and the built jar to /usr/share how ever if I run lein help I get the issue's below if i happen to have .lein_classpath in a project it works but I dod not normally need this, can you explain why I may be hitting this issue, to get it included It needs to be built rather than just downloaded to be included, obviously I am missing a step which is causing the issue below.

lein help
Leiningen's classpath: /usr/share/leiningen/self-installs/leiningen-2.9.8-standalone.jar
'help' is not a task. See 'lein help'.

Did you mean this?
         help
clojure.lang.ExceptionInfo: Task not found
{:exit-code 1, :suppress-msg true}
 at leiningen.core.main$task_not_found.invokeStatic (main.clj:247)
    leiningen.core.main$task_not_found.doInvoke (main.clj:239)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.Var.invoke (Var.java:384)
    leiningen.core.main$resolve_task.invokeStatic (main.clj:293)
    leiningen.core.main$resolve_task.invoke (main.clj:287)
    leiningen.core.main$resolve_task.invokeStatic (main.clj:295)
    leiningen.core.main$resolve_task.invoke (main.clj:287)
    leiningen.core.main$apply_task.invokeStatic (main.clj:325)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__2143.invoke (main.clj:453)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)
technomancy commented 2 years ago

Can you list the contents of the jar file in question? This happens when the classpath does not contain the file leiningen/help.clj.

olymk2 commented 2 years ago

https://pastebin.com/imKPWgxf

I am running these commands below, the project.clj has been modified to set the m2 folder because of permissions in the build environment,

    curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > lein
    chmod a+x ./lein
    cd leiningen-core
    cp $pkgfiles/project.clj ./
    ../lein bootstrap
    ../lein uberjar

I am also running sed on the lein file to set LEIN_HOME to the install folder using this. ` sed -i 's@export LEIN_HOME="${LEIN_HOME:-"$HOME/.lein"}"@export LEIN_HOME="/usr/share/leiningen"@' ../bin/lein

`

help.clj is certainly missing for some reason so I guess I am doing something wrong with the above.

technomancy commented 2 years ago

OK, it looks like you're generating the uberjar from the leiningen-core library, which is not an application. That's why it doesn't include the tasks like help. You need the leiningen uberjar, not leiningen-core.

olymk2 commented 2 years ago

Thanks for the assistance this got me on the right track, now packaged the repo for the package build is https://dev.getsol.us/source/leiningen/repository/master/ for future reference