redhat-developer / redhat-developer/vscode-java

localRepository in vscode not working

Open
#3,811 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

I defined in the .vscode/settings.json of the project

./.vscode/settings.json

{
"java.configuration.maven.userSettings": "${HOME}/.m2/settings-my.xml", 
"maven.executable.options": "-s ${HOME}/.m2/settings-my.xml"
}

settings-my.xml has a directory ${HOME}/mvn_repo defined in its localRepository.

However, the code hints in vscode's editor window keep showing that the classes present in the ${HOME}/mvn_repo directory cannot be found. It looks like the editor or the language server could not index the classes from the specified localRepository directory, what can I do?

Environment
  • Operating System: macos
  • JDK version: openjdk version "21.0.4" 2024-07-16 LTS
  • Visual Studio Code version: Version: 1.94.0 (Universal)
  • Java extension version: Extension Pack for Java v0.29.
Steps To Reproduce

${HOME}/.m2/settings-my.xml

<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 http://maven.apache.org/xsd/settings-1.2.0.xsd">
	<localRepository>${HOME}/mvn_repo</localRepository>
	<servers>
         ...
Current Result

image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with .vscode/settings.json and ${HOME}/.m2/settings-my.xml using the listed macOS, JDK, VS Code, and Java extension versions; start by tracing how the Java language server consumes Maven settings and localRepository. Done means classes in ${HOME}/mvn_repo are indexed and no longer reported missing in VS Code code hints.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.