Fork me on GitHub
#leiningen
<
2018-11-08
>
zlrth21:11:12

i have the following jvm-opts

:jvm-opts ["-Xmx3g"
             "-XX:+StartAttachListener"
             "-Dcom.sun.management.jmxremote"
             "-Dcom.sun.management.jmxremote.ssl=false"
             "-Dcom.sun.management.jmxremote.authenticate=false"
             "-Dcom.sun.management.jmxremote.port=43210"]
for a clojurescript and clojure app, that i occasionally profile using visualvm (hence the jmxremote stuff). right now, if i lein repl a clojure repl, and lein figwheel a cljs one, it complains about port 43210 already being bound. can i have a conditional jvm-opt?

mikerod21:11:06

@mfm you could use a separate profile for each (or at least one)

mikerod21:11:14

I think you want these enabled for the lein repl?

mikerod21:11:19

so put them in a clj-side onyl profile

mikerod21:11:34

then lein with-profile clj-jmx-remote repl (made up that profile name)

mikerod21:11:12

you could also put an alias over that to make it less to type if you are needing to do that frequently

zlrth21:11:16

ooh that's good. yeah i think i want it only for lein repl; i'm actually posting about this on behalf of my team, and i'm not sure what exact workflow they have

zlrth21:11:39

with-profile is great, thanks. i'll look into that. i think we

zlrth21:11:46

'll profile relatively rarely

mikerod21:11:04

:aliases {"jmx-repl" ["with-profile" "clj-jmx-remote" "repl"]}

mikerod21:11:17

then you could do lein jmx-repl

mikerod21:11:22

for that particular case

mikerod21:11:27

(or whatever you want to call these things)

mikerod21:11:28

be aware profiles merge values together

mikerod21:11:23

So outside your profile for jmx, you maybe want to share

:jvm-opts ["-Xmx3g"
           "-XX:+StartAttachListener"]
Then in the profile, you’d put the jmx stuff like:
:profiles {:clj-jmx-remote {:jvm-opts ["-Dcom.sun.management.jmxremote"
                                       "-Dcom.sun.management.jmxremote.ssl=false"
                                       "-Dcom.sun.management.jmxremote.authenticate=false"
                                       "-Dcom.sun.management.jmxremote.port=43210"]}}

🌞 4
mikerod21:11:37

(not sure if “-XX:+StartAttachListener” was specific to jmx/remote profiling or not)

zlrth21:11:22

very helpful thanks!

mikerod21:11:11

no problem