Fork me on GitHub
#boot
<
2016-07-22
>
ska09:07:53

Topic of the day: Adding logging to my current boot-driven project. Logging in uberjar works like expected. I can not find out how to set logging to TRACE in my dev environment automatically, though. Any pointers welcome. 🙂

martinklepsch10:07:57

@ska: more information needed 🙂 What logging lib?

kurt-yagram11:07:18

Hey, I'm new to boot, and I'm just trying some basic things: when I run 'boot pom jar', I get 'writing <project>.jar', but I can't find the resulting jar anywhere.

kurt-yagram11:07:42

Is this intended, or am I doing something terribly wrong?

ska11:07:09

@martinklepsch: tools.logging 0.3.1 + log4j 1.2.16

martinklepsch11:07:22

@kurt-yagram: files are not written to your project directory's target by default, try boot pom jar target

ska11:07:32

Am currently investigating creating a namespace to make everything very dynamic (reloading of default resources, loading other resources, setting log levels at run-time yaddayadda)

kurt-yagram11:07:30

if I want to upload to a private repo, with a build.boot:

(set-env!
 :source-paths #{"src/clj"}
 :resource-paths #{"resources"}
 :repositories [["clojars" {:url ""}]
                ["central" {:url ""}]
                ["internal" {:url "https://<ip-address>/repo/repository/internal/"
                             :username "xxx"
                             :password "xxx"}]
                ["snapshots" {:url "https://<ip-address>/repo/repository/snapshots/"
                             :username "xxx"
                             :password "xxx"} ]]
 :dependencies '[[org.clojure/clojure "1.8.0"]])

(task-options!
 pom {:project '<project>
      :version "1.0.0-SNAPSHOT"}
 aot {:namespace '#{<namespace>}}
 jar {:manifest {}}
 push {:repo "snapshots"})

kurt-yagram11:07:26

When I want to deploy, I do get (boot pom jar push):

Could not transfer metadata <project>:<project>:1.0.0-SNAPSHOT/maven-metadata.xml from/to snapshots (https://<ip-address>/repo/repository/snapshots/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I can access the repo from the browser using username and password.

dominicm11:07:47

The java certificate manager is a little out of date I believe.

dominicm11:07:12

If you use something like letsencrypt, it'll fail.

dominicm11:07:03

Yes, that is the exception when the trust store does not contain the right certificate.

kurt-yagram11:07:23

it's a apache archiva repo... don't know about the certificate manager... So, if I understand well, the maven repo should be configured differently (or the trust store thereof)?

dominicm11:07:44

Not an abstraction most have to touch. Java has it's own list of certificate issuers. If yours isn't on the list, it throws that exception. The trust store of your local JVM needs a manual override. I don't don't know how this is done though.

kurt-yagram11:07:20

ok... I'll check that, thanks! (True, on my browser, I had to 'accept an exception')

ska12:07:31

OK, I solved my problem mentioned earlier using deep log4j voodoo...

nha16:07:30

boot-environ works fine for me in dev, but not when using aot. Has anyone hit that ? ( https://github.com/weavejester/environ/blob/master/boot-environ/src/environ/boot.clj#L31 )

nha16:07:34

(if I remove the aot task, I loose my main so I can't do that)

micha16:07:28

@nha: i recommend using AOT just to create a shim class that delegates actual functionality to clojure

micha16:07:32

(ns app.main-class
  (:gen-class))
  
(defn -main [& args]
  (require 'app.main)
  (apply (resolve 'app.main/-main) args))

nha16:07:35

Hmm my main is basically the same as here (with the require/resolve), isn't that what you mean ? https://github.com/Deraen/saapas/blob/master/src/clj/backend/main.clj

micha17:07:24

if you make the main-class shim type thing there

micha17:07:35

then you don't AOT any of your clojure code

nha17:07:45

ok makes sense.

nha17:07:03

So that's why the values are not read.

nha17:07:21

It it was aoted then they would be compiled in, right ?

micha17:07:37

yeah aot causes many weird issues

micha17:07:41

so i just avoid it all

nha17:07:32

Right ^^ the joys of production. I understand why it's not working now, not sure however how to fix it.

nha17:07:39

I should read my config in my init function then I guess, that would work just as well

nha17:07:10

Thanks micha ! I am always impressed by the time you put into answering questions here !

micha17:07:55

@nha: it's my pleasure!

micha18:07:15

@alexmiller: yes it's the jar that boot boots from

micha18:07:01

all it knows how to do is download boot.jar, which is the real boot code

micha18:07:10

is it a problem for you?

micha18:07:11

i didn't want to have to maintain a complex set of shell scripts that have OS package dependencies etc

micha18:07:27

this allows us to do most of the work in the JVM

Alex Miller (Clojure team)18:07:49

just impressed by the creativity :)

micha18:07:00

ah hahaha, thanks

thomas21:07:23

Hi all, I am getting a NPE from ring:

java.lang.NullPointerException
	at ring.middleware.reload$wrap_reload$fn__1018.invoke(reload.clj:22)

thomas21:07:50

and I am trying to start my compojure webserver in dev mode… not quite sure where I go wrong

thomas21:07:07

this is my code

(serve :handler 'gps-tracker.handler/handler
               :reload true
               :init 'gps-tracker.handler/init)

thomas22:07:53

ok solved it… my handler wasn’t called handler… DOH

thomas22:07:10

But thank you for listening to me anyway 😉