redhat-developer / redhat-developer/vscode-java

localRepository in vscode not working

未关闭
#3,811 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
2.3k
派生
547
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用列出的 macOS、JDK、VS Code 和 Java 扩展版本,通过 .vscode/settings.json 和 ${HOME}/.m2/settings-my.xml 重现;首先跟踪 Java language server 如何使用 Maven 设置和 localRepository。完成标准是:${HOME}/mvn_repo 中的类已建立索引,并且不再在 VS Code 代码提示中报告为缺失。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
developer-experience, tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。