vscode-maven icon indicating copy to clipboard operation
vscode-maven copied to clipboard

Installing dependencies in a folder name ${maven.home} instead of the real maven.home directory

Open KafkaWannaFly opened this issue 2 years ago • 1 comments

Describe the bug

When I opened a Maven project, it would look for pom.xml and download dependencies to my machine local repository which normally is ${user.home}/.m2/repository. But when I change the local repository to ${maven.home}/repositories in the setting.xml VSCode would create a folder called ${maven.home} in the working directory then put all dependencies inside it instead of the real ${maven.home}

To Reproduce

  1. Download maven from https://maven.apache.org/download.cgi
  2. Extract and set its binary folder to the PATH environment variable
  3. At the downloaded folder, go to conf/settings.xml
  4. Add this piece into the setting tag <localRepository>${maven.home}/repositories</localRepository>
  5. Open the VSCode setting page and set the global maven setting to the editted settings.xml above
  6. Open any maven project and see the result

Expected behavior

VSCode would install dependencies in the real ${maven.home}/repositories directory

Environments

  • Edition Windows 10 Pro
  • Version 21H1
  • Installed on ‎2021-‎05-‎27
  • OS build 19043.1110
  • Experience Windows Feature Experience Pack 120.2212.3530.0
  • VS Code version: 1.58.2
  • Extension version v0.31.0

Screenshots

image

Workaround

Use absolute directory path in the settings.xml

KafkaWannaFly avatar Jul 25 '21 07:07 KafkaWannaFly

Similar to #646 , so far the extension doesn't understand maven-specfic variables like ${maven.home}, as we don't have a systematic way to resolve them.

However, this extension is not responsible for downloading artifacts into your local maven repository. And java.configuration.maven.globalSettings is provided by Java Extension. It's possibly a bug in Java language server.

//cc @testforstephen for awareness

Eskibear avatar Jul 26 '21 03:07 Eskibear