Fork me on GitHub
#boot
<
2018-02-16
>
borkdude12:02:14

I’m getting an exception while building an uberjar: https://gist.github.com/borkdude/cd8ded50d80012fe8ed6ed70b692626a java.lang.IllegalArgumentException: Prefix string too short

seancorfield17:02:11

@borkdude Run boot with the -b option to see what's on that line -- looking at the exception and the code, it suggests that it's trying to create a temporary file with a prefix filename that is less than three characters... But looking at the Boot source, I can't figure out how that could happen...

borkdude18:02:21

thanks. I went another route meanwhile, not including this hairball of dependencies in our app

donaldball18:02:51

Hey fellow bootineers. I’m trying to write a task to function similar to lein run. The docs suggest something like

(require 'my.ns)
(deftask run
  "Runs a command-line action"
  []
  (with-pass-thru _
    (apply my.ns/-main *args*)))
Unfortunately, I can’t require my.ns at that point because the classpath doesn’t have all of the required resources, which are conditionally and necessarily established by other tasks in the pipeline. Naively, I would expect to put the require call just before the apply call, but that gives me a ClassNotFoundException.

donaldball19:02:17

Thanks, it was exactly that simple and obvious.

donaldball19:02:29

My followup may not be quite as much. My main invocation takes a couple of positional params that I do not wish to convert into switched args. The boot docs suggest the command-line form boot [ run foo bar ] will populate the *args* var, but I get an exception:

clojure.lang.ExceptionInfo: [
    data: {:file
           "/var/folders/q8/q9m6fhqx7jz9r9wz72dsvsxh0000gn/T/boot.user683874268861742912.clj",
           :line 35}
java.lang.ClassNotFoundException: [
                                 ...
clojure.core/ns-resolve/invokeStatic  core.clj: 4336
clojure.core/ns-resolve/invokeStatic  core.clj: 4325
   clojure.core/resolve/invokeStatic  core.clj: 4338
                clojure.core/resolve  core.clj: 4338
           boot.core/construct-tasks  core.clj:  903

borkdude19:02:23

maybe you should first name the task name?

borkdude19:02:43

I’ve never used that form, but boot foo [arg1 arg2 arg2] maybe works? it’s a guess

donaldball19:02:45

run is the name of the task; foo bar are the positional params I’m trying to convey

seancorfield19:02:59

boot [ run -- foo bar ] is what I read that doc page to be suggesting @donaldball

seancorfield19:02:36

Ah, that's only to pass option-like things in... my bad...

seancorfield19:02:52

OK, now you've made me curious to test this! 🙂

seancorfield19:02:30

OK, a simple example works as the docs say:

(deftask donald []
  (prn *args*))

$ boot [ donald foo bar ]
["foo" "bar"]
$
so the ClassNotFoundException is coming from something else in your build.boot

donaldball19:02:29

Heh, wow thanks for doing my legwork for me 😛

donaldball19:02:08

Though… that’s not the behavior I’m seeing!

donaldball19:02:11

(deftask stroll
  []
  (prn *args*))

donaldball19:02:27

~/src/fme/service[add-membrane]$ boot [ stroll foo bar ]
      clojure.lang.ExceptionInfo: [
    data: {:file
           "/var/folders/q8/q9m6fhqx7jz9r9wz72dsvsxh0000gn/T/boot.user7707068072930942461.clj",
           :line 37}
java.lang.ClassNotFoundException: [
                                 ...

donaldball19:02:55

However, updating to 2.7.2 seems to fix it so perhaps it was simply a regression in 2.6.0. Apologies for the noise!

seancorfield19:02:15

Maybe it wasn't supported in 2.6.0?

richiardiandrea19:02:24

sorry for being late, but I think the above feature is indeed a new-ish addition

seancorfield19:02:29

FWIW, I can repro that exception with Boot 2.6.0 🙂

seancorfield20:02:20

Works on 2.7.0 so I'm guessing it was one of the many new features in 2.7...