Allow :jvm-opts to be set in project.clj.
Note: this forces the project to run in a forked JVM, which increases startup time. Use sparingly.
This commit is contained in:
parent
7e493d6b46
commit
d67d7d7cb9
3 changed files with 10 additions and 7 deletions
|
@ -86,6 +86,9 @@ Other keys accepted:
|
|||
Specify this as a map of repo IDs to URLs.
|
||||
* :source-path, :compile-path, :library-path, :test-path, :resources-path -
|
||||
alternate paths for src/, classes/, lib/, resources/, and test/ directories.
|
||||
* :jvm-opts - a list of arguments to pass to the project-level JVM
|
||||
|
||||
TODO: spin this list off into its own file and explain each option better
|
||||
|
||||
## FAQ
|
||||
|
||||
|
|
|
@ -78,11 +78,9 @@
|
|||
nil)))
|
||||
|
||||
(defn get-jvm-args
|
||||
"Returns a seq of strings with the arguments sent to this jvm instance."
|
||||
[]
|
||||
(-> (ManagementFactory/getRuntimeMXBean)
|
||||
(.getInputArguments)
|
||||
(seq)))
|
||||
[project]
|
||||
(concat (.getInputArguments (ManagementFactory/getRuntimeMXBean))
|
||||
(:jvm-opts project)))
|
||||
|
||||
(defn eval-in-project
|
||||
"Executes form in an isolated classloader with the classpath and compile path
|
||||
|
@ -107,9 +105,10 @@
|
|||
:default native-path)))))
|
||||
(.setClasspath java (apply make-path (get-classpath project)))
|
||||
(.setFailonerror java true)
|
||||
(when (or (:fork project) (= :macosx (get-os)) native-path)
|
||||
(when (or (:fork project) (:jvm-opts project)
|
||||
(= :macosx (get-os)) native-path)
|
||||
(.setFork java true)
|
||||
(doseq [arg (get-jvm-args)]
|
||||
(doseq [arg (get-jvm-args project)]
|
||||
(when-not (re-matches #"^-Xbootclasspath.+" arg)
|
||||
(.setValue (.createJvmarg java) arg))))
|
||||
(.setClassname java "clojure.main")
|
||||
|
|
1
todo.org
1
todo.org
|
@ -20,6 +20,7 @@ Leiningen TODOs
|
|||
* For 1.2.0
|
||||
** DONE make org.clojure implied for clojure/contrib deps
|
||||
** DONE better way to force setFork in eval-in-project
|
||||
** TODO document all known project.clj keys
|
||||
** TODO System/exit appropriately when testing based on pass/fail (abedra)
|
||||
*** Needs to set permissions with the ant API's Java task
|
||||
** DONE rename :namespaces key in project.clj
|
||||
|
|
Loading…
Reference in a new issue