Fork me on GitHub
#boot
<
2016-02-04
>
superstructor00:02:21

Hello, I’m somewhat new to boot. Aiming to move a release process to boot over the coming days; e.g. versioning, git flow branching/tagging, building an RPM with redline RPM etc. Any pointers or examples of prior work would be appreciated simple_smile

mattly01:02:38

I’m new to boot and trying to pull down a dependency on the jdbc-postgres driver. it’s giving me this error message:

mattly01:02:36

I’m not sure where the problem is or how to troubleshoot

mattly01:02:01

hm, maybe it’s something else

raywillig01:02:25

can you paste the relevant part of your build.boot file?

seancorfield01:02:19

Line 7 of your build.boot perhaps? A deftask with incorrect argument declarations?

micha01:02:44

boot -b will print the generated script, so you can see what line 7 of it is

richiardiandrea03:02:33

Hello guys, is there a reason why (exit-error) and (exit-ok) always spit out the stacktrace (even when I use exit-ok)?

Summary
Ran 6 tests, 10 assertions, 0 failures, 0 errors
             clojure.lang.ExceptionInfo: boot.App$Exit: 0
    data: {:file "/tmp/boot.user2127203706560941948.clj", :line 19}
java.util.concurrent.ExecutionException: boot.App$Exit: 0
                          boot.App$Exit: 0
   boot.task-helpers/fn/fn/fn/fn/fn  task_helpers.clj:  264
      boot.task-helpers/fn/fn/fn/fn  task_helpers.clj:  264
      boot.task-helpers/fn/fn/fn/fn  task_helpers.clj:  244
 
If someone wants to try, it is in sift-fix-test branch in my repo

richiardiandrea04:02:25

so @seancorfield I cannot see the discussion, is there an issue open somewhere?

seancorfield04:02:59

I asked about those functions back when I was working on boot-expectations. I was surprised (exit-ok) generated an exception. I don't recall what @micha said but it does seem that exiting with an exception is "idiomatic"...

seancorfield04:02:31

At least exiting with an exception on failure.

richiardiandrea04:02:37

but if with return 0 ?

seancorfield04:02:53

It's very weird to exit with an exception when exiting with a zero status...

seancorfield04:02:11

I don't think I've seen other tasks actually do that tho'...

richiardiandrea04:02:53

yeah maybe we can improve on that, I saw there is some kind of catching and retroving here https://github.com/arichiardi/boot/blob/sift-fix-test/boot/pod/src/boot/util.clj#L221

richiardiandrea04:02:04

and that line prints the exception

richiardiandrea04:02:32

because from somewhere it receives a ex-info wrapping a App.Exit

richiardiandrea04:02:48

so maybe it is some sort of issue

dominicm08:02:26

@micha https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/task/built_in.clj#L309 would this delay stop the get-env from evaluating until the fileset passes through?

dominicm08:02:50

Explaining why the launched repl doesn't have dependencies.

dominicm08:02:58

But using with-eval-in, works.

dominicm09:02:48

https://clojars.org/io.dominic/boot-cljs I've just used my personal deployment in the edge repo, so, yay!

dominicm09:02:56

How would I fork the built in boot tasks, to test out my theory about the delay?

dominicm09:02:40

ah, instructions in the readme.

dominicm10:02:46

@micha for the repl, I created a pod, and passed it along as an argument to the repl task.

dominicm10:02:53

Seems to work. No need for a change.

micha13:02:14

@dominicm: that delay in the repl task probably needs to be fixed, i think you're right there

micha13:02:05

we should get the dependencies from the env before making the delay

micha13:02:23

@dominicm: nice!

micha13:02:08

your build.boot there is like a tour of boot internals and how to make it do what you want

micha13:02:44

@dominicm: did you see the boot.core/launch-nrepl function?

dominicm13:02:41

heh, boot is pretty powerful, and not too far from being flexible. We've definitely achieved something neat.

micha13:02:45

it doesn't handle dependencies, but we could make it do so via with-env

dominicm13:02:18

I should have written down why I didn't use core/launch-nrepl. Ummmm...

dominicm13:02:22

OOH, now I remember.

dominicm13:02:46

So, I was creating my pod, and then passing it's name to core/launch-nrepl, but as the pod was going out of scope, the pod was being destroyed. And as the repl runs "with-pass-thru" it waits until other tasks have finished to run (I think?), so it delays, and the pod can't be held onto. (or maybe it can?) So yeah, I just figured it was easier to go direct.

micha14:02:04

maybe we can modify that function to have it optionally start a new pod

micha14:02:30

that way we can have it in the public api so it'll be protected from breaking changes

micha14:02:12

you can avoid the pod falling out of scope by keeping a reference to it, in an atom perhaps

micha14:02:50

boot.user=> (def server-pod (doto (boot.pod/make-pod boot.pod/env) (.setName "server-pod")))
#'boot.user/server-pod
boot.user=> (launch-nrepl :pod "server-pod" :server true)
nREPL server started on port 55459 on host 127.0.0.1 - 
#object[boot.core$launch_nrepl$fn__1086 0x45699404 "[email protected]"]

dominicm14:02:03

Yeah, I wasn't sure if that was much less of a hack. Fortunately the repl/launch-nrepl function takes the same params as core, pretty much.

dominicm14:02:12

But I can't be sure it will always be, yep

micha14:02:31

yeah, the only issue is that it's not part of the public api so it might change

micha14:02:33

we try not to do that though

richiardiandrea16:02:13

@micha about the stack trace when boot returns zero...is there anything we can do about it ?

micha16:02:41

probably, what's printing it?

richiardiandrea16:02:56

clojure.lang.ExceptionInfo: boot.App$Exit: 0
    data: {:file "/tmp/boot.user2613241006960267934.clj", :line 19}
java.util.concurrent.ExecutionException: boot.App$Exit: 0
                          boot.App$Exit: 0

richiardiandrea16:02:41

richiardiandrea [8:45 PM] yeah maybe we can improve on that, I saw there is some kind of catching and retroving here https://github.com/arichiardi/boot/blob/sift-fix-test/boot/pod/src/boot/util.clj#L221 [8:46] and that line prints the exception [8:46] because from somewhere it receives a ex-info wrapping a App.Exit

richiardiandrea16:02:09

I tracked it down to that part by println in both branches of exit-ok

richiardiandrea16:02:42

exiting for the final time, it chooses the false branch

tolitius17:02:28

creating a runnable uberjar, but can't start it due to Caused by: java.lang.ClassNotFoundException: java.util, compiling:(clojure/tools/reader/default_data_readers.clj:1:2) https://gist.github.com/tolitius/5f1dc640977f6a5ee101 I am converting the project from lein, so I must be missing something.

micha17:02:08

is something trying to compile that file?

micha17:02:20

cause it's not a namespace

dominicm17:02:17

is it a dependency that's failed to come across?

dominicm17:02:54

that your profiles.clj may have been pulling in?

tolitius17:02:17

deps seem to be one to one. which file? stream-on.app?

micha17:02:57

i was wrong, that is a legit namespace

micha17:02:10

i thoguht it might be the data_readers file

alandipert17:02:23

@tolitius: do you have a dependency on clojure in your build.boot somewhere? because you need one to get bundled in the jar

micha17:02:39

if you do jar tf target/stream-on.jar do you see all the things it's suppsoeed to have in there?

tolitius17:02:39

ah.. that might be it :)

tolitius17:02:28

the clojure explicit dep is missing, I thought I'd be transitively brought in

tolitius17:02:33

thanks guys!

tolitius17:02:49

(will try after lunch)

alandipert17:02:55

since uber has gotten faster the 'exploder' part isn't really necessary anymore, but i do recommend the Java proxy approach so you don't have to aot

tolitius18:02:30

@alandipert: great thx, I'll give it a try

richiardiandrea18:02:14

so about AppExit 0 do we have an opinion, maybe an option to disable stacktrace printing?

micha18:02:57

yeah i'm not sure why it's printing a stack trace if the exit status is 0, anyway

micha18:02:06

seems odd that it would do that

richiardiandrea18:02:41

@seancorfield had the same problem I guess, it might be an issue if you say that and I will investigate

micha18:02:06

yeah i don't remember all the ins and outs there at the moment

yenda18:02:21

what do you have to do to remove the warning about target directory ?

yenda18:02:47

I mean despite from editing the boot.properties

yenda18:02:42

I can't find my jar after calling ubermain task

micha18:02:40

@yenda: you can use the target task now

micha18:02:56

boot ubermain target

seancorfield18:02:03

@richiardiandrea: Do you want to open an issue in GH for tracking the AppExit 0 exception / stack trace thing?

laforge4918:02:52

@yenda I no longer get target directory warnings with boot 2.6.0-SNAPSHOT. And it works great now with windows 10 too. Though I still need to turn off jetty's use of mapped files. simple_smile

alandipert18:02:44

@laforge49: have you happened to have tried the hoplon 'get started' app on win10 w/ boot 2.6.0-snapshot?

yenda19:02:05

ubermain doesn't work for me but (comp aot pom uber jar) does

alandipert19:02:01

@yenda: ubermain is an experimental thing that i haven't use dmyself lately... best to stick with what works

laforge4919:02:02

@alandipert: Is there something special about that demo? I'm finding that EVERYTHING works now except headless JS unit tests.

alandipert19:02:09

@laforge49: no, and that's great! i ask because of activity on https://github.com/hoplon/hoplon/issues/80

yenda19:02:55

alandipert: ok it worked with {:main-var burp-clj.core/-main :file "burp-clj"})

laforge4919:02:08

Well, as I said, you also need to turn off jetty mapped files. Hmm. I should write this up today.

yenda19:02:14

I was using 'burp-clj

yenda19:02:36

it would be nice if it had the same params as jar ?

yenda19:02:10

also I thought the file option will be name of the jar but it is still project.clj, not sure if this can be configured

laforge4919:02:56

@yenda are you using adzerk.bootlaces?

yenda19:02:35

it works fine with (uber)

yenda19:02:45

so i'm gonna stick with that

yenda19:02:06

reading from the source code file is unused in ubermain

tolitius19:02:57

@alandipert: adding an explicit clojure dep did not help (it actually does bring it transitively as well) for uber taks, but simply using boot-ubermain works great, thx

tolitius19:02:58

one gotcha though.. I don't think a --file option is used: https://github.com/adzerk-oss/boot-ubermain/blob/master/clj/adzerk/boot_ubermain.clj#L22 so it always creates a project.jar regardless of :file "foo.jar" option

yenda19:02:38

@tolitius: yes that's what I just said 😉

tolitius19:02:11

oh.. you are quicker.. I don't type fast simple_smile

yenda19:02:24

i think it just needs :file (or file nil) line 38

micha19:02:00

:file file would work too, cause it'll be nil otherwise, no?

laforge4919:02:47

Only I'm thinking this wiki page should be moved to boot, hmm?

yenda19:02:43

also wouldn't it be better for api consistency to have the same signature for the main function as the jar function ?

yenda19:02:50

or am I missing something ?

yenda19:02:34

I mean having the option like that :main 'burp_clj.core instead of :main-var burp-clj.core

alandipert19:02:27

@tolitius: ok i think the problem might be with the :main arg to jar

alandipert19:02:12

it takes a class, not a var sym

alandipert19:02:47

@tolitius: so i think it should be :main 'stream_on.app maybe

alandipert19:02:54

since AOT-ing munges

laforge4919:02:59

I'll drop the old page on hoplon and change the reference in getting started to point to the new page.

alandipert19:02:10

@tolitius: i am remembering this with the help of https://github.com/adzerk-oss/boot-uberjar-example that i also haven't touched in awhile

tolitius19:02:15

@alandipert: yep, boot-uberjar-example is what I started from, so the :main 'stream_on.app very well maybe it, since looking at the stacktrace, it does not look like it finds what's in main

pppaul20:02:13

hey booters

pppaul20:02:06

i'm doing some hacking on castra, and have set up boot to point to my local-fork. i'm having an issue with castra not pulling in it's deps

pppaul20:02:20

i see it's boot ffile has a merge-env!

pppaul20:02:49

what is the best way for me to get my forked castra pulling down/mapping it's deps?

micha20:02:07

are you making a jar with your forked version?

micha20:02:12

and using that in your application?

pppaul20:02:11

i used :source-paths #{"src" "../../castra/src"}

micha20:02:31

the best way to get the dependencies to all work is to install a jar in your local maven repo

micha20:02:40

and then have your application depend on that

pppaul20:02:41

sounds like it may be a bit slow

micha20:02:44

you can use the checkout task, it takes like 0.02s to make a jar and install it simple_smile

pppaul20:02:13

do you have an example i could reference?

micha20:02:30

sure the boot checkout -h output has an example

tolitius20:02:32

is there something like lein-release for boot?

micha20:02:23

the idea is you run boot watch build-jar or whatever in the checkout project

micha20:02:44

and you do boot watch checkout -d ... in the application project

pppaul20:02:18

is that significantly different from boot watch pom -p foo/bar -v 1.2.3-SNAPSHOT jar install?

micha20:02:51

nope, pretty much the same i think

dm320:02:13

@tolitius - the closest you can get out of the box is build-jar push-release from bootlaces

dm320:02:40

then somehow devise a way to update the version

tolitius20:02:25

@dm3: thx, yea that's what I use for my evening work simple_smile but at the day job there is a dedicated build team that does not like changes that much.. so I am trying to make it as precooked as possible for them

dm320:02:55

would be best then to write it yourself simple_smile wouldn't take much for a simple jar

tolitius20:02:20

sure, just wanted to check first. thank you

richiardiandrea20:02:46

@seancorfield: @micha see my comment in the PR, no issue, just don't call exit-ok twice

tolitius20:02:31

btw, what would be the way to pass an uberjar (cooked with (uber) or (ubermain)) to the push task?

alandipert21:02:19

@tolitius: with the -f and -P flags

tolitius21:02:44

ah.. shoot, of course

tolitius21:02:58

I was thinking on how to chain it, but push can just pick it up

tolitius21:02:03

thanks @alandipert

alandipert21:02:19

sure! altho i would add uberjars in maven is usually not what you want

alandipert21:02:25

what are you trying to do?

tolitius21:02:50

usually you would not, I agree. the way things are deployed (around where I am) is using rpms

tolitius21:02:57

so I am trying to bend that a little

tolitius21:02:19

to have a self contained jar there instead

tolitius21:02:22

the current build process drops those rpms in maven repos ¯\(ツ)

alandipert21:02:10

cool. yeah i worked somewhere that did the same

alandipert21:02:18

at some point i wanna try to get fpm running in a jruby pod

alandipert21:02:30

so we can have legit rpm, deb facilities

tolitius21:02:24

yea, it's rare but bites hard when needed simple_smile

yenda21:02:55

what is the difference between the uber and ubermain task btw ? is it that uber explodes all the dependencies and ubermain does not ?

alandipert21:02:25

@yenda: that's right, ubermain adds the deps to the classpath at runtime

alandipert21:02:35

@yenda: the same way eg tomcat does

alandipert21:02:55

since java -jar doesn't natively do anything if you have a jar with jars in it

yenda21:02:04

in which case would it be better not to explode the jars ?

alandipert21:02:33

exploding the jars at runtime makes the build faster at the expense of runtime... not a big deal in the servlet scenario usually because the app container usually adds the jars to the servlet container classpath once per deploy

alandipert21:02:56

for the uberjar case, imo not a win, since the uberjar is only run once

alandipert21:02:17

several months ago ubermain made more sense when uber was a lot slower

alandipert21:02:20

now, it's a wash imo

alandipert21:02:25

the only fringe benefit is not needing to AOT

alandipert21:02:44

which is in ubermain but unrelated to the jar explode part

yenda21:02:09

ok thanks for the explaination

pppaul21:02:27

@micha: I was able to get the checkout working in the shell and in the build.boot file for the demo/simple-castra example. however after the deps are pulling down for castra, the app can't find the castra namespaces

seancorfield21:02:28

Oh, so "user" code (tasks etc) should never call exit-ok at all then?

seancorfield21:02:28

I guess then the question is: should user code even call exit-error or should it just throw an exception to exit with an error?

alandipert21:02:53

throwing an exception is the most composable thing imo

alandipert21:02:00

since previous tasks can choose to catch

pppaul21:02:13

@micha: nevermind, i removed the dep from the set-env! and that was what was causing problems... silly me

seancorfield21:02:25

I think that's what I have boot-expectations do but I should probably clean up boot-new in that respect.

richiardiandrea21:02:42

probably it was a way to exit clenly from middlewares

richiardiandrea21:02:40

but if we implement what I wrote in the issue, we can still take advantage of that

richiardiandrea21:02:49

nonetheless this should be specified in exit-ok and exit-error doc, I have an open PR for documentation changes

pppaul21:02:52

when running boot, how do people deal with debugging?

richiardiandrea21:02:42

@pppaul: you can (reset! boot.util/verbosity 1/2/3)

richiardiandrea21:02:56

but in general not too many traces

richiardiandrea21:02:25

it is an atom with an int inside

pppaul21:02:59

i'm looking at the code

pppaul21:02:24

so, do i have to use boots print methods in my project?

micha21:02:08

you mean like boot.util/info etc?

pppaul21:02:28

(println) isn't working

micha21:02:38

those are nice to use if you make a task that others will use, because it prints the different types of messages in a consistent way

micha21:02:47

how do you mean?

micha21:02:52

println should work fine

pppaul21:02:37

oh, i see my print statements now

pppaul21:02:50

does boot have something like lein's profiles?

tolitius21:02:01

@alandipert: push does not seem to pick up a file generated by ubermain. tried file-regex / file with absolute path.. but it looks like it gets to the push task before ? the jar is synced with fs

(comp
 (ubermain)
 (target)
 (push ;; :file-regex #{#"project.jar$"}
       ;; :file ".../stream-on/target/project.jar"
       :ensure-snapshot true
       :ensure-clean false
       :repo-map {:url "...-snapshots"
                  :password "..."
                  :username "..."})))

alandipert21:02:49

@tolitius: i'll take a look later

alandipert21:02:02

were you not able to get normal uber to work?

tolitius22:02:50

no.. tried the _ thing, might need to spend more time on it. with "ubermain / push", there is definitely something simple I am missing about how tasks chained in general, since (comp (ubermain) (target)) works fine, but (comp (ubermain) (target) (push)) ends up with an exception in ubermain:

java.util.concurrent.ExecutionException: java.lang.NullPointerException: entry
             ...
             adzerk.boot-template/eval374/fn/fn/fn        boot_template.clj:   38
               adzerk.boot-ubermain/pack-jar/fn/fn        boot_ubermain.clj:   12

micha22:02:46

pushing an uberjar is highly unusual

micha22:02:52

are you sure that's what you want to do?

alandipert22:02:15

yeah i already quizzed him on this

micha22:02:22

it compromises the dependency graph if anyone depends on it

micha22:02:44

ah ok sorry

alandipert22:02:17

that's a weird error, but ubermain is also weird. and i don't remember how it worked really 😞

alandipert22:02:21

i'll take a look later tho

tolitius22:02:27

@micha: sure, not something I would normally do. the place I am working at at the moment pushes rpms to maven repos (build process, not something I can change). so the idea is to use self contained jars instead (for parts that I create)

alandipert22:02:29

in the meantime i recommend getting normal uber going

tolitius22:02:12

@alandipert: sure, thanks. I'll switch to (uber)

pppaul22:02:26

if i want to add some debugging namespaces to my files with boot, would i use with-pre-wrap or one of the similarly named functions?

pppaul22:02:45

does anyone have an example of something similar to this?

richiardiandrea22:02:37

doc added to PR #394, btw do I need to rebase it or something?

micha22:02:47

if it can merge cleanly into 2.6.0-SNAPSHOT branch that would be ideal

richiardiandrea22:02:08

I will rebase, now the other PR has merge conflicts, but against master, I have already rebased

micha23:02:53

i think we probably want to merge those into 2.6.0-SNAPSHOT branch, no?

micha23:02:07

so conflicts with master should be okay

superstructor23:02:24

For a stable build, is it recommend to use BOOT_CLOJURE_VERSION=1.7.0 or BOOT_CLOJURE_VERSION=1.8.0 in build.boot with boot version 2.5.5 ?