librelist archives

« back to archive

lein deploy fails with NullPointer

lein deploy fails with NullPointer

From:
Sebastian Hennebrueder
Date:
2014-09-22 @ 12:53
Executing lein deploy by accident outside of a project directory or with a
project file missing the version information, leeds to the following 
beauty:

-> lein deploy
java.lang.NullPointerException: null
 at java.util.regex.Matcher.getTextLength (Matcher.java:1234)
    java.util.regex.Matcher.reset (Matcher.java:308)
    java.util.regex.Matcher.<init> (Matcher.java:228)
    java.util.regex.Pattern.matcher (Pattern.java:1088)
    clojure.core$re_matcher.invoke (core.clj:4460)
    clojure.core$re_find.invoke (core.clj:4512)
    leiningen.pom$snapshot_QMARK_.invoke (pom.clj:361)
    leiningen.deploy$deploy.invoke (deploy.clj:159)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invoke (core.clj:626)
    leiningen.core.main$partial_task$fn__6071.doInvoke (main.clj:253)
    clojure.lang.RestFn.invoke (RestFn.java:410)

The culprit is the snapshot? method in leiningen.pom expecting a String in
(:version project)

My question: How would you like to get this fixed?

a)
snapshort? fails with main/abort on missing version

b)
all deploy variants fail if project variable is empty, which is a hint 
that no project.clj was found

c)
deploy without repository parameter fails on empty project cli?



-- 
Best Regards / Viele Grüße

Sebastian Hennebrueder

-----
http://www.laliluna.de
Software developer and Coach for Java, JEE, Clojure and Java Persistence

Re: [leiningen] lein deploy fails with NullPointer

From:
Phil Hagelberg
Date:
2014-09-22 @ 15:48
The root problem here is that deploy has ^:no-project-needed metadata
because one of its arities can run outside a project, but the other one
requires a project. Because of this, I think that b is the best
solution. There is an existing "no project found" message+abort function
in leiningen.core.main we should use for this.

Re: [leiningen] lein deploy fails with NullPointer

From:
Sebastian Hennebrueder
Date:
2014-09-22 @ 21:57
Hi,

I am not fully convinced that b) is more readable, after completing the code.

Here are both variants as patches

-- 
Best Regards / Viele Grüße

Sebastian Hennebrueder

-----
http://www.laliluna.de
Software developer and Coach for Java, JEE, Clojure and Java Persistence

Am 22.09.2014 um 17:48 schrieb Phil Hagelberg <phil@hagelb.org>:

> The root problem here is that deploy has ^:no-project-needed metadata
> because one of its arities can run outside a project, but the other one
> requires a project. Because of this, I think that b is the best
> solution. There is an existing "no project found" message+abort function
> in leiningen.core.main we should use for this.