technomancy/leiningen — pull request #1230 by stuartsierra (2013-06-18 18:58:45+00:00)
Title: Set default :jvm-opts in :base profile to :displace

Leiningen's `:base` profile has the following defaults:

:jvm-opts ["-XX:+TieredCompilation" "-XX:TieredStopAtLevel=1"]

When the default behavior for `:jvm-opts` is additive, it can lead to
unexpected results if a project tries to add its own options which
conflict with the defaults. For example, the following setting:

:jvm-opts ["-XX:-TieredCompilation"]

Results in a JVM command line like this, in which the project's JVM
options are overridden by the defaults:

-XX:-TieredCompilation -XX:+TieredCompilation -XX:TieredStopAtLevel=1

This led to confusion on the part of people who were trying to run
benchmarks on some Clojure code. See the [mailing list discussion].

By setting `:displace` metadata on the default `:jvm-opts`, any
project configuration of `:jvm-opts` will replace the defaults.

Notes:

The wiki section on [Tiered Compilation] says one should use
`:jvm-opts ^:replace []` to turn off tiered compilation.

The [FAQ] mentions that users can avoid tiered compilation by running
`lein with-profile production ...`.

[mailing list discussion]: https://groups.google.com/d/msg/clojure/LTtxhPxH_ws/jpQIg8PWMLsJ
[Tiered Compilation]: https://github.com/technomancy/leiningen/wiki/Faster#tiered-compilation
[FAQ]: https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md