Fork me on GitHub
#boot
<
2016-11-24
>
bones00:11:43

Why do I get a file not found exception when I’m running boot repl and try require my file?

bones00:11:07

and I’ve done (set-env! :source-paths #{”src”})

bones00:11:21

I run boot repl from root of dir and my file has namespace mappr.core which lives in src

bones00:11:45

How should I load my namespaces from the boot repl?

alandipert02:11:53

it's src/mapper/core.clj? Should be (require 'mapper.core)

hagmonk03:11:12

I’m tripping over some boot basics and thought I’d ask here … basically I’m trying to get a simple “hello world” app going and it’s a pretty frustrating experience

hagmonk03:11:54

(require 'boot.repl)

(set-env!
  :resource-paths #{"src"}
  :dependencies '[[org.clojure/clojure "1.8.0" :scope "provided"]])

(task-options!
  pom {:project 'bernhard
       :version "1.0.0"}
  jar {:main 'bernhard.core}
  aot {:all true})

(deftask build []
         (comp
           (javac)
           (pom)
           (uber)
           (jar :main 'bernhard.core)
           (sift :include #{#"project.jar"})
           (target :dir #{"target"})))

hagmonk03:11:27

then in src/bernhard/core.clj I have a -main function defined exactly as I would with leiningen

hagmonk03:11:53

but

boot build ; java -jar target/project.jar
always tells me that bernhard.core can’t be found

alandipert03:11:26

@hagmonk you're never calling the aot task

alandipert03:11:47

looks like you need (aot) somewhere in your comp before jar

alandipert03:11:58

pro tip: boot repl and then (load-file "build.boot") every time you change it, then you can call (boot) at repl after changes instead of waiting for boot to start. good for debugging build.boot problems like this

alandipert03:11:13

or rather, (boot (build))

hagmonk04:11:54

:thumbsup: I’ll try this when I get back to my project, thanks!

bones04:11:32

@alandipert its just “mappr.core” (no ‘e’ in it cause I’m so trendy 😉 )

bones04:11:04

but yes src/mappr/core.cljs

alandipert04:11:48

ooh it's a cljs file? are you using the cljs repl? that stuff is harder to get working

alandipert04:11:03

boot is a clj thing, so in boot's default repl you can't require cljs

bones04:11:38

yeah it’s cljs

bones04:11:45

Ah okay, I see i need the cljs-repl ATOP the regular repl

bones04:11:49

Thanks very much

lmergen05:11:56

hey guys, im a little bit confused as to how exactly i should instruct boot to build a library, rather than running a program that has a main

lmergen05:11:16

basically, when i look at the jar it generates using pom jar install, it includes no classes

juhoteperi05:11:50

@lmergen But does it include the .clj files?

lmergen05:11:25

nop, not either

lmergen05:11:35

thats the (simple) build.boot file

juhoteperi05:11:52

you should have src in :resource-paths instead of :source-paths

juhoteperi05:11:00

Then the files from that folder are included in output (jar)

lmergen05:11:12

as source ? or as class ?

juhoteperi05:11:33

Clojure libraries are usually distributed as source

lmergen05:11:37

ok, thanks

lmergen05:11:50

@juhoteperi sweet, that worked! i knew it must've been something simple

martinklepsch08:11:25

@jiyinyiyong not sure but this probably mostly depends on what you tell the JVM to use. You can restrict it more and it will GC more often and use less.

Jon08:11:47

any guide please, I want to try it

pesterhazy14:11:00

I'm running into the boot+circleci inotify issue

pesterhazy14:11:18

@nberger I saw you reported this before. Did you ever find a solution?

pesterhazy14:11:15

or is there a way to disable inotify watches in boot? I don't think it's needed for my dist task

juhoteperi15:11:57

@pesterhazy I don't think there is option for this currently

juhoteperi15:11:23

https://github.com/boot-clj/boot/blob/master/boot/core/src/boot/core.clj#L184-L198 Boot will always use file change watcher to look for changes in source dirs

pesterhazy15:11:11

@juhoteperi I see, thanks

juhoteperi15:11:14

Some kind option to tell Boot that changes don't matter would be useful for CI use case

juhoteperi15:11:32

Cljsjs CI process is running into these errors from time to time

nberger15:11:51

@pesterhazy oh yes, the rebuild button 😕. Got a response from circleci: they analyzed the issue, agreed that the solution is to increase the limit on their side but they are not going to increase it or allow users to do it because not much people was reporting it (seemed like mine was the first report)

pesterhazy15:11:15

yeah I don't blame them

pesterhazy15:11:22

boot does create a lot of watches 🙂

nberger15:11:06

Yep. And the issue didn't manifest too frequently in my project

nberger15:11:39

And circleci is awesome, so all good

pesterhazy15:11:44

they're awesome indeed

pandeiro17:11:08

When trying to follow the uberjar example repo recipe, I get an error at the uber task: manifest.properties (No such file...) Do I need to create this file manually?

pandeiro17:11:52

Oh god it was the file perms issue again, nvm

pandeiro17:11:49

One more doubt: is it not possible to make an uberjar with boot without adding a Main.java file, as in the example?

alandipert17:11:19

Yeah- use aot and gen class. Iirc I updated example?

alandipert17:11:06

Lame, I didn't

alandipert17:11:51

But yeah gen class a single clj ns, and in its -main fn require and resolve the clj ns and real main function

alandipert17:11:01

That way you don't suffer transitive aot

alandipert17:11:24

Same approach is taken in main.java

Tim19:11:42

with lein, I think all the dependency classes are stored in ./target so where are these dependency classes stored with boot?

pandeiro23:11:11

Thanks @alandipert, got it working great that way. Couldn't figure out how to name the jar something other than project.jar but I could live with that.