Question

I have a project.clj file derived from someone else's git repo. There's a line that reads

:jvm-opts ^:replace []

I know that :jvm-opts allows adding java command line options. What does ^:replace do? There is some about it in Leiningen's profile.md, and it's mentioned in Leiningen's example project file sample.project.clj, but I still don't understand. I want to add "-Xmx1G" to to jvm-opts.

Was it helpful?

Solution

Just add to the options vector the one you need:

:jvm-opts ["-Xmx1g"]

If you have more than one:

:jvm-opts ["-Xmx1g" "-server"]

replace can be used in many configuration options where different map sets or vectors are merged.

So in this situation if you want the jvm-opts to be only the ones you specify use replace metadata (otherwise other options may be merged depending on your configuration)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top