Replies: 2 comments 1 reply
|
There are two separate controls that are useful here. If you only want to stop Maven from going to remote repositories while the Java importer is running, enable Maven offline mode: {
"java.import.maven.offline.enabled": true
}If the main issue is specifically that Maven is writing to {
"java.configuration.maven.userSettings": "/absolute/path/to/vscode-java-maven-settings.xml"
}Example <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<localRepository>/absolute/path/to/some/cache/m2-repository</localRepository>
</settings>So the practical setup is: use |
|
You can redirect Maven's local repository instead of letting it use the default ~/.m2/repository. For example, create a Maven settings.xml with: /path/to/your/maven-repoThen configure vscode-java to use that settings file with java.configuration.maven.userSettings. Alternatively, Maven supports the maven.repo.local property to specify the local repository location. I don't think there is a vscode-java setting that completely disables the Maven local repository while still allowing Maven to resolve the referenced libraries. For an unmanaged project, the Maven-based artifact resolution is what causes the local cache to be populated. So if the goal is simply to keep ~/.m2 untouched, redirecting the local repository is probably the safer approach. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
It seems like this extension will try to find a corresponding artifact of a "java.project.referencedLibraries" referenced library in Maven Central. Then a default Maven is invoked and downloads them to ~/.m2 for uses like showing definitions. However, I do not want file appearing in my home directory. How would I prevent this behavior?
Note: There's no Maven project, but only a unmanaged project that has reference to libraries downloaded from Maven Central.
All reactions