Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOME vs -Duser.home + -Dmaven.repo.local #2318

Open
lukateras opened this issue Sep 26, 2017 · 5 comments
Open

HOME vs -Duser.home + -Dmaven.repo.local #2318

lukateras opened this issue Sep 26, 2017 · 5 comments
Labels

Comments

@lukateras
Copy link
Contributor

lukateras commented Sep 26, 2017

Currently Leiningen uses two different values for the home directory:

  • HOME environment variable for ~/.lein
  • user.home JVM 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).

@winks
Copy link
Collaborator

winks commented Sep 26, 2017

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.

@technomancy
Copy link
Owner

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.

@lukateras
Copy link
Contributor Author

lukateras commented Dec 15, 2017

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.

@technomancy
Copy link
Owner

I'd take a patch for a new setting to look in a different location than ~/.m2/repository for the local repo.

@glts
Copy link
Collaborator

glts commented May 25, 2019

Just noting that such a fix/feature would have to be implemented in Pomegranate, not Leiningen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants