This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-11
Channels
- # aws (2)
- # babashka (11)
- # beginners (107)
- # calva (6)
- # cljsrn (18)
- # clojure (180)
- # clojure-australia (6)
- # clojure-europe (54)
- # clojure-losangeles (9)
- # clojure-nl (4)
- # clojure-uk (13)
- # clojureladies (1)
- # clojurescript (57)
- # clojureverse-ops (1)
- # consultantsdirectory (1)
- # cursive (48)
- # datomic (11)
- # defnpodcast (3)
- # degree9 (1)
- # deps-new (5)
- # depstar (21)
- # docker (2)
- # fulcro (15)
- # helix (32)
- # kaocha (1)
- # lsp (21)
- # malli (15)
- # meander (15)
- # news-and-articles (2)
- # nextjournal (1)
- # off-topic (42)
- # pathom (3)
- # podcasts (1)
- # polylith (73)
- # protojure (1)
- # re-frame (43)
- # reagent (1)
- # releases (1)
- # restql (1)
- # schema (1)
- # sci (1)
- # shadow-cljs (23)
- # spacemacs (7)
- # sql (5)
- # tools-deps (42)
- # vim (15)
- # xtdb (3)
I'm was looking for a way to do lein install
but with cli tools. I found clojure -X:deps mvn-install
but that requires me to reference a jar file. So I guess my question is... how to I build the jar file then? 😅
tools.build of course :)
I cloned the Clojure library https://github.com/nextjournal/beholder tbh I don't understand how I am supposed to build it
You generally don't need to install libraries locally to use them. Just declare them as dependencies in your project.
I know that but I changed something in it that I want to try out
OK, so use :local/root
as a dependency on it.
in a lein project 😉
Haha... OK, well, there's your problem 🙂
OK then probably the easiest way to make a JAR from beholder is to use depstar
, since beholder doesn't have a build script or any aliases for that.
to figure out what that is
Here's the steps you need:
(! 1026)-> git clone [email protected]:nextjournal/beholder.git
Cloning into 'beholder'...
...
(! 1027)-> cd beholder/
(! 1028)-> clojure -X:deps mvn-pom
(! 1029)-> clojure -Sdeps '{:aliases {:depstar {:deps {com.github.seancorfield/depstar {:mvn/version "2.1.278"}}}}}' -X:depstar hf.depstar/jar :jar beholder.jar
Building thin jar: beholder.jar
Processing pom.xml for {beholder/beholder {:mvn/version "0.1.0"}}
(! 1030)-> clojure -X:deps mvn-install :jar '"beholder.jar"'
Installing beholder.jar
Installed to /Users/sean/.m2/repository/beholder/beholder/0.1.0
(edited to show actual commands and results)
Then you can depend on it (via lein
or here in a CLI REPL):
(! 1033)-> clj -Sdeps '{:deps {beholder/beholder {:mvn/version "0.1.0"}}}'
Clojure 1.10.3
user=> (require 'nextjournal.beholder)
nil
user=> (nextjournal.beholder/watch prn ".")
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See for further details.
#object[io.methvin.watcher.DirectoryWatcher 0x65bb9029 "[email protected]"]
user=> (spit "test.txt" "Hello")
nil
user=> {:type :create, :path #object[sun.nio.fs.UnixPath 0x69ee6735 "/Users/sean/clojure/fresh/./test.txt"]}
beholder officially uses https://github.com/applied-science/deps-library for it's jars/release process. So that's probably the supported path.
The beholder
project only seemed to have a :release
alias so I wasn't sure what would be needed without also tracking down that library and learning about it 🙂
@jacob429 Hope the above gets you going...
I hadn't heard of it before, but searched for "release.edn" on github and it came up 🙂
(pity there's no docs in beholder
or its deps.edn
file to make that clear since they're using a deps/release process that is not common/mainstream 🙂 )
I think depstar
is the most widely used JAR builder for deps.edn
-based projects currently? But I hope it will be able to go away once tools.build
's uber
task does more merging stuff.
I'd like to have deps.edn
be my source of truth and use it to generate my pom.xml
- is there a way to specify what should go in the <scm>
tag? Right now cljdocs integration is broken because I don't have a source link in there.
@winsome that's why clj-new
generates a fully-fledged pom.xml
into new projects.
It's just like lein new
. But you could use it to create a new project somewhere, with the same qualified project name that your current project has, and then copy the generated pom.xml
file into your project.
I'm working on deps-new
which will be able to overlay new files into existing projects (and is much, much simpler to write new templates for).
Adding a full-featured pom.xml
file is a good new feature for deps-new
-- I'll create an issue.
yeah, it's something I never think of until it's release time, which can be quite distant from creation time (never in most cases :p)
@dominicm Thanks clojure -M:release install
seemed to work
is there a way to configure the clj
/`clojure` commands globally so that we can apply a particular command line argument to all clj
/`clojure` calls? for example, i would like to set --report stderr
globally so that i don't have to change each and every existing call to these commands.
not currently
in general, I think -J-Dclojure.main.report=stderr
is better for the Clojure CLI as it composes better with main args and -X etc
you could make an alias with :jvm-opts ["-Dclojure.main.report=stderr"]
that could be combined with any other alias
this question is for default jvm opts https://ask.clojure.org/index.php/7834/support-default-jvm-opts if you want to vote for it (which would let you do the thing above more broadly)
but I think adding such a thing needs much more consideration in how it combines