HOME vs -Duser.home + -Dmaven.repo.local
Currently Leiningen uses two different values for the home directory:
-
HOMEenvironment variable for~/.lein -
user.homeJVM system property for~/.m2
To move home (if the home directory is read-only, e.g. /var/empty) one currently needs to set both HOME and _JAVA_OPTIONS=-Duser.home=<value>. Before 2.8.0-RC1, if HOME is not writable ~/.lein just won't be created, but since 2.8.0-RC1 Leiningen exits when that happens, which might break some builds.
Also, Leiningen doesn't honor maven.repo.local JVM system property (~/.m2/repository by default).
Thanks, that's good to know! Some random thoughts for now (as a user):
a) I think 2.8.0-RC1 being stricter and just exiting is good. I think builds can usually be fixed and before it was implicitly fragile anyway, right?
b) Regarding the 2 methods/values... I guess we should document the current order and/or add some fallback mechanism.
c) Regarding maven.repo.local - not sure whether to classify that as bug or missing feature.
It's definitely intentional that we don't just follow settings that are for Maven. The point of the Aether library is that while many programs can share the same underlying implementation as Maven, they are distinct from Maven and shouldn't be expected to honor Maven's settings.
The problem with $HOME vs the Java system property is that Java system properties don't exist before the JVM is started, so operations which necessarily must precede launching the JVM (such as deciding what classpath to use for the JVM) must be calculated in terms of concepts which exist outside the JVM. This is just an inherent quirk of bootstrapping, and I don't see any way around it.
Before 2.8.0-RC1, if HOME is not writable ~/.lein just won't be created, but since 2.8.0-RC1 Leiningen exits when that happens, which might break some builds.
Can you be more specific? I can run some lein commands without write privileges to ~/.lein.
It's definitely intentional that we don't just follow settings that are for Maven. The point of the Aether library is that while many programs can share the same underlying implementation as Maven, they are distinct from Maven and shouldn't be expected to honor Maven's settings.
Given that both Maven and Leiningen use the same path to local Maven repository, they are compatible, and there should be an option to switch both to another location.
Currently it's only possible to switch home location for Leiningen, but not Maven repo location.
I'd take a patch for a new setting to look in a different location than ~/.m2/repository for the local repo.
Just noting that such a fix/feature would have to be implemented in Pomegranate, not Leiningen.