This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-10
Channels
- # aws (3)
- # beginners (186)
- # boot (25)
- # cider (2)
- # cljsrn (57)
- # clojure (161)
- # clojure-boston (1)
- # clojure-dusseldorf (11)
- # clojure-italy (5)
- # clojure-russia (20)
- # clojure-serbia (1)
- # clojure-spec (10)
- # clojure-uk (16)
- # clojurescript (207)
- # community-development (86)
- # core-async (2)
- # cursive (40)
- # datascript (1)
- # datomic (2)
- # editors (5)
- # emacs (8)
- # funcool (1)
- # gsoc (2)
- # hoplon (2)
- # jobs (5)
- # leiningen (3)
- # liberator (18)
- # luminus (18)
- # off-topic (106)
- # om (2)
- # onyx (5)
- # pedestal (7)
- # powderkeg (7)
- # re-frame (7)
- # remote-jobs (1)
- # ring-swagger (4)
- # rum (5)
- # slack-help (1)
- # untangled (11)
- # yada (48)
did you try it?
oh, now I remember
I think I was just using the pom for deps only, so it parses the XML rather than downloading maven jars to build a full project object model in memory
pull requests are welcome 😉
I suppose version variables like that are primarily useful for maven modules (multi-projects), for which there isn’t really an analog in either lein or boot
well, not without a lein plugin
I mean, there are other ways to skin the multi-project cat with boot, but that doesn’t help you in this case
Hi there, I’m hoping for some help with a simple build task that I’m using.
(deftask build
"Build the project locally as a JAR."
[d dir PATH #{str} "the set of directories to write to (target)."]
(let [dir (if (seq dir) dir #{"target"})]
(comp
(aot)
(pom)
(uber)
(jar)
(target :dir dir))))
It’s taken from an example somewhere, and works fine. The issue I’m facing is that the contents of a resources/ directory at the root of my project are copied to the top of directory structure in the jar file.
I’ve toyed around with :resource-paths and :asset-paths a little, but not sure where to go next to figure this out.
Any advice would be great. Thanks
Oh, and here is some of my build.boot
(set-env! :resource-paths #{"resources"}
:source-paths #{"test" "src"}
:dependencies '[
(task-options!
aot {:namespace #{'app.main}}
pom {:project project
:version version
:description ""
:url ""
:scm {:url ""}
:license {"" ""}}
jar {:main 'app.main
:file (str "app-" version ".jar")})
@pjullah you could make a directory resources/resources
and then move your files there
@alandipert good idea. But, everything works fine when working in the repl. I think I’d end up with two different paths to my files in dev and prod.
@pjullah it sounds like at the repl you might be referring to items by file, not by classpath
as long as you refer only to files on the classpath, you should be fine in both cases
i.e. via
@alandipert thanks. I think I see what you mean. I’ll have a play around and see what mess I can get myself into 🙂
@alandipert hmm. still no joy. my file is at /resources/config.edn
and is used like
(ns app.conf
(:require [mount.core :as mount :refer [defstate]]
[clojure.edn :as edn]
[ :refer [resource]]
[clojure.tools.logging :refer [info]]))
(defn load-config [path]
(info "loading config from" path)
(-> path
slurp
edn/read-string))
(defstate config
:start (load-config "resources/config.edn"))
So I took your advice and have tried both
(resource "config.edn") => nil
(resource "resources/config.edn") => nil
Is this what you meant, or have I misunderstood?@pjullah i don’t see anything obviously wrong with that
@pjullah i made a simplified example: https://github.com/alandipert/resources-example
@alandipert thanks. That works. Given that you didn’t need to reference “resources/” would suggest that it’s on the classpath. Which leads me to conclude that “resources/” is not on my classpath… (in my project)
i recommend working at the repl to troubleshoot, you can call set-env!
and resource
there
if you make changes to your build.boot
you can also reload it without restarting jvm by callind (load-file "build.boot")
at repl
no prob, glad you figured it out