This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-01
Channels
- # admin-announcements (1)
- # aws (1)
- # beginners (14)
- # boot (19)
- # cljs-dev (10)
- # cljsrn (2)
- # clojure (64)
- # clojure-android (4)
- # clojure-dev (5)
- # clojure-greece (7)
- # clojure-italy (10)
- # clojure-russia (42)
- # clojure-spec (117)
- # clojure-uk (78)
- # clojurescript (160)
- # cloverage (1)
- # conf-proposals (1)
- # cursive (8)
- # datomic (93)
- # editors (8)
- # editors-rus (5)
- # figwheel (1)
- # flambo (14)
- # hoplon (95)
- # jobs (2)
- # jobs-rus (1)
- # lambdaisland (4)
- # lein-figwheel (6)
- # leiningen (3)
- # om (106)
- # onyx (33)
- # planck (6)
- # proton (3)
- # protorepl (2)
- # random (2)
- # re-frame (9)
- # reagent (5)
- # ring (1)
- # untangled (61)
- # yada (50)
Well, given you need to use gen-class
(which is definitely worth confirming), the problem you may be running into is that the class is not created unless you are aot-compiling.
spring wants a java class with a particular static method?
Well, it may be easier to create the class in Java and invoke Clojure from it. There’s an API for that: http://clojure.github.io/clojure/javadoc/
Spring creates a java object, that I then want to pass to my clojure code. So I have a static function in clojure that takes it and sets it for toher clojure function to access it
gen-class should be able to do it though; it's just confusing and AOT is no fun
if you're controlling the calling code from java, just use the java→clojure api directly
unless you need to use beans and then I have no idea what's going on
I'm not though, Spring is in charge. The whole thing is a custom java web server which heavily uses spring
okay I'm probably out of my depth; but writing the java class in java sounds cleanest to me
& easiest
In particular: http://clojure.github.io/clojure/javadoc/clojure/java/api/package-summary.html
Ok, my problem was that I wasn't using the fully qualified namespace for defining my return type in my gen-class, because I thought the import would work in there also for me to only use the class name, but it does not
Does gen-class default :main to true? So if I don't want a main, I have to set main to false explicitly?
Well, that’s the case if you are invoking gen-class
directly. The doc for ns
states that it provides some defaults if you are doing :gen-class
.
I'd say the best way to do that is when you're calling the external program that needs to see the environment variable.
You can't change an environment variable in your parent process, if that is what you hoped you could do.
https://clojuredocs.org/clojure.java.shell/sh has an :env argument that you can use to pass the environment that you'd like to set up.
yeah, but that env would only apply for the sub process within the repl, am I correct ?
If you want to set your parent process' environment, you'll have to hack around. A common way is to use the shell's eval command and print the environment variables to stdout.
Is there any standard macros/function for #(func2 (apply func1 %&)) ? Something like (wrap func1 func2) ?
I'm streaming the results of a jdbc query with a lazy-seq and I want to wrap that with an input-stream so I can upload to s3 with amazonica, but I can't figure out what's the best way to do that.
@spacepluk Take a look at https://github.com/ztellman/byte-streams - specifically, the first mention of to-input-stream
in the README looks like what you're after
clojure.data.xml has suddenly begun adding shortcut namespaces, like <a:foobar>…</a:foobar>
instead of just <foobar></foobar>
. I haven’t upgraded the version (`[org.clojure/data.xml "0.1.0-beta1”]`)
it looks like that changed between beta1 and beta2, so for some reason you are getting beta2
Oh … https://github.com/clojure/data.xml/commit/e84990d37ee25e6c7c4651bb0c435e8b77e17128
you can end up with some unexpected transitive dependency behavior, the easiest thing is to look at the deps :tree result, and add some :exclusions. if you specify the exact version you want as a direct dependency that should override any transitive dependency.
if data.xml is a dependency of anything you depend on, and any of your dependencies are aot compiled, that can lead to wonkiness too
Seems explicitly depending on beta2 fixes it … which makes me even more puzzled, since it’s been working fine with beta1
@grav i always set :pedantic? :abort
which forces you to explicitly deal with any ambiguities in the set of transitive dependencies (or lein borks)
@mccraigmccraig good idea!