Fork me on GitHub
#boot
<
2017-09-26
>
ag04:09:45

if I have a task workflow adorned by watch, is it possible to run something when that watch gets killed? i.e. When user presses Ctrl-C I want to run a sh command...

ag06:09:29

I guess I'm gonna have to use boot.pod/add-shutdown-hook!

dominicm07:09:41

@ag returning identity would cause this problem. With pass thru is the correct solution

dominicm08:09:32

Weird how that didn't do a mention

carr0t10:09:13

If I'm wanting to use boot.lein/generate so I can use Cursive in IntelliJ ( https://github.com/boot-clj/boot/wiki/For-Cursive-Users ) is there any way I can make that run automatically before any other boot command without adding stuff to build.boot?

dominicm10:09:53

@carr0t profile.boot you mean?

carr0t10:09:01

I've got a load of shared boot jobs and I don't really want to add the library to all of them when I'm the only Cursive user, but when I tried putting the calls into my profile.boot it of course loaded and ran than before build.boot, so I didn't have any of my libs in the generated project.clj

dominicm10:09:31

yeah, use profile.boot

carr0t10:09:22

So what do I need to put in there so that it runs those commands after loading the project-specific build.boot and thus has the right libs reference?

carr0t10:09:33

Or do you mean just run the command manually when needed?

dominicm10:09:15

@carr0t how do you start boot?

carr0t10:09:31

Normally I just run whatever command I need for the project directory containing the build.boot file. So boot test on the command line or whatever

dominicm11:09:54

add this to profile.boot:

(set-env! :dependencies '[[onetom/boot-lein-generate "0.1.3" :scope "test"]])
(require 'boot.lein)
(boot.lein/generate)
Then you can do: boot boot.lein/generate test instead

mikepjb16:09:11

Hi I am getting an issue when uberjaring a project using boot

mikepjb16:09:15

Exception in thread "main" java.lang.NoClassDefFoundError: com/stuartsierra/component/Lifecycle

mikepjb16:09:26

loading the project through boot repl seems to work

mikepjb16:09:19

#!/usr/bin/env boot

(set-env!
  :source-paths #{"src" "dev"}
  :resource-paths #{"resources"}
  :dependencies '[[org.clojure/clojure "1.8.0"]
                  [com.stuartsierra/component "0.3.2"]
                  [liberator "0.14.1"]
                  [yada "1.2.6"]
                  ;; [onetom/boot-lein-generate "0.1.3" :scope "test"]
                  [org.clojure/tools.namespace "0.2.11"]
                  [org.clojure/core.async "0.3.443"]
                  ])

;; (require 'labs-server.core)
;; (require 'boot.lein)

(task-options!
  pom {:project 'labs-server
       :version "0.1.0"}
  aot {:namespace #{'labs-server.core}}
  jar {:main 'labs-server.core
       :file "labs-server.jar"}
  target {:dir #{"target"}})

(deftask build
  "Build uberjar"
  []
  (comp
   (aot)
   (pom)
   (uber)
   (jar)
   (target)))

(deftask labs
  "Run this server locally and reload file changes"
  [p port VAL int "Set the repl port"]
  (require 'labs-server.core)
  (let [run-server (resolve 'labs-server.core/-main)] (run-server))
  (repl :port (or port 9999)))

mikepjb16:09:47

I’ve done some googling and tried putting :gen-class in each file that uses component

mikepjb16:09:07

setting the aot :namespace manually to include component too.. it’s quite confusing to be honest!

alandipert16:09:11

mikepjb how are you running the uberjar?

danielcompton20:09:36

@mikepjb you need to make sure that you're requiring com.stuartsierra.component before the :import runs

danielcompton20:09:21

can you share a redacted version of the file where the exception is coming from?