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

Change location of .m2/ and .tooling/ from HOME #1654

Closed
jarek083 opened this issue Feb 2, 2021 · 2 comments · Fixed by #1655
Closed

Change location of .m2/ and .tooling/ from HOME #1654

jarek083 opened this issue Feb 2, 2021 · 2 comments · Fixed by #1655
Assignees

Comments

@jarek083
Copy link

jarek083 commented Feb 2, 2021

When I'm using this LSP, two cache directories are created in my home directory. I've tried to make wrapper and set HOME=$XDG_CACHE_HOME or pass -Duser.hom=$XDG_CACHE_HOME, but those are still created in home.

~/.tooling is especially bad, as I have other tool which uses this directory, but for important data, not cache.

Could ~/.m2 and ~/.tooling be moved to something like $XDG_CACHE_HOME/eclipse.jdt.ls/m2 and $XDG_CACHE_HOME/eclipse.jdt.ls/tooling?

Environment variables to control those would be fine too.

@rgrunber
Copy link
Contributor

rgrunber commented Feb 2, 2021

While we don't currently support configuring the local repository ($HOME/.m2/repository/) directly, we do have java.configuration.maven.userSettings and java.configuration.maven.globalSettings which configure the location of the user/global settings file. That file, among other things can configure the location of the local repository. See https://maven.apache.org/ref/3.6.3/maven-settings/settings.html for more details on what can be configured there.

So in your properties file, you could just set java.configuration.maven.userSettings=/my/preferred/location/settings.xml and in the settings file ensure you have <localRepository>/my/preffered/repository/location/</localRepository>

I think you could even avoid setting the property if you don't mind placing the settings file in ${user.home}/.m2/settings.xml (according to #1586 (review)).

As for .tooling, looking at places like https://github.com/eclipse/eclipse.jdt.ls/blob/8028f3ffc04e7f4695ffa08d058912e2003a0116/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/internal/gradle/checksums/WrapperValidator.java#L256 , it seems to be hard coded for now.

@snjeza
Copy link
Contributor

snjeza commented Feb 2, 2021

As for .tooling, looking at places like
eclipse.jdt.ls/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/internal/gradle/checksums/WrapperValidator.java
Line 256 in 8028f3f
return new File(System.getProperty("user.home"), ".tooling/gradle/versions.json");
, it seems to be hard coded for now.

This was a buildship upstream issue - https://github.com/eclipse/buildship/blob/REL_3.1.4/org.eclipse.buildship.core/src/main/java/org/eclipse/buildship/core/internal/util/gradle/PublishedGradleVersions.java#L221
The issue has been fixed - https://github.com/eclipse/buildship/blob/REL_3.1.5/org.eclipse.buildship.core/src/main/java/org/eclipse/buildship/core/internal/util/gradle/PublishedGradleVersions.java#L221
We should update Java LS.

@snjeza snjeza self-assigned this Feb 2, 2021
@rgrunber rgrunber added this to the End February milestone Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants