This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-15
Channels
- # announcements (2)
- # aws (52)
- # beginners (326)
- # cider (24)
- # clara (7)
- # clj-kondo (14)
- # cljs-dev (175)
- # clojure (183)
- # clojure-ecuador (2)
- # clojure-europe (4)
- # clojure-italy (11)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-spec (5)
- # clojure-sweden (5)
- # clojure-uk (103)
- # clojurescript (49)
- # cursive (29)
- # data-science (9)
- # datascript (17)
- # datomic (23)
- # emacs (6)
- # events (4)
- # fulcro (19)
- # graalvm (8)
- # graphql (2)
- # hoplon (36)
- # jobs (1)
- # jobs-discuss (92)
- # juxt (3)
- # luminus (10)
- # off-topic (4)
- # pedestal (8)
- # planck (1)
- # re-frame (59)
- # reagent (1)
- # reitit (22)
- # rewrite-clj (8)
- # ring-swagger (3)
- # shadow-cljs (101)
- # spacemacs (15)
- # tools-deps (36)
- # vim (68)
Is anyone aware of a tools-deps dependency visualizer? (i.e. the equivalent of https://github.com/walmartlabs/vizdeps)
A little rusty with Clojure on JVM...if I want to work against a Java code base, do I need to include taarget in order to import
classes in the REPL using clojure
?
yes, assuming target is the root of your compiled classes
ok cool that's what I was missing then, I guess it goes without saying that I then need to compile the java code every time the file changes
thank you Alex that works
Hello, what do people use to watch for file changes to trigger actions (e.g. clojure.core/compile
)? Lein certainly has a watch functionality/plugin but what about clj CLI? Thanks!
as above, clj doesn't cover compilation
it does cover "running programs"
the compiler is a program
watching is a program
compose programs, run with clj if you like
thank you, Alex. My question is essentially: Does anyone made a clj-friendly plugin for watching files and executing actions upon change?
I'm not aware of something specific to tools.deps, but there several watcher type things out there
last time I needed one, I just wrote the 60 lines of java interop to use the one in the jdk
admittedly, it's a weird java api
https://www.clojure-toolbox.com/ has a bunch of filesystem watcher libs
@holyjak I use (load "core")
to load/reload files
But usually it's a "built-in" feature from your IDE/Plugin/Editor/..
well, I need to watch for changes to run compile
automatically...
Personally, I don't like watcher-based workflows. I usually find the watch fires when I don't want it to and/or gets into a bad state because it fires while there are still errors in the code.
I'd much rather have an explicit compile
command in a (comment ...)
form that I can eval from my editor without even worrying about what the terminal is doing.
(also, why do you need to run compile
at all? what features are you relying on that require Clojure code to be compiled?)
https://github.com/holyjak/clj-concordion - integration with Java Specification by Example test framework that expects me to give it Fixture objects with test-specific methods. So you do `(deffixture "class.Name" [fns2expose as methods]) for each specification document.
good points about the downsides of watchers, thank you!
Ah... so you're relying on code gen / gen-class
rather than reify
for this?
exactly ,as there is no interface to reify
Wied problem: while this works
clj -J-javaagent:bin/springloaded-1.2.5.RELEASE.jar -J-noverify
this fails: ; deps.edn: [...]
:aliases {:agent {:jvm-opts ["-J-javaagent:bin/springloaded-1.2.5.RELEASE.jar" "-J-noverify"]}}
; CLI:
$ clj -O:agent
Unrecognized option: -J-javaagent:bin/springloaded-1.2.5.RELEASE.jar
Why?You want
:aliases {:agent {:jvm-opts ["-javaagent:bin/springloaded-1.2.5.RELEASE.jar" "-noverify"]}}
oh I see, please ignore đ I have to omit -J
Given a .clj
file path, what is the simples way of finding out the namespace of the file? I could read the first line and check for #"\(ns (\w+)"
but there is surely a cleaner way?
There's no guaranteed way because you can change namespaces inside a file and you can load arbitrary source files into another namespace.
The convention is path/to_the/file.clj
=> path.to-the.file
tho' -- note the _
to -
mapping. And you'll need to know what it is _relative to your classpath_ because if src/main
is on your classpath, src/main/path/to_the/file.clj
is what will get loaded if you try to require path.to-the.file
thank you!
tools.namespace is a lib for doing this kind of thing