redhat-developer / redhat-developer/vscode-java

Maven importer should support custom POM filenames or honor maven.pomfile.globPattern

未关闭
#4,455 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Problem

A Maven Java project uses pom-customize.xml instead of pom.xml.

Maven itself works:

mvn -f pom-customize.xml compile

The VS Code Maven extension can be configured to discover it:

{
  "maven.pomfile.globPattern": "**/{pom.xml,pom-customize.xml}"
}

But the Java language server does not import the Maven classpath from pom-customize.xml. Java files then show false diagnostics such as:

RestController cannot be resolved to a type

Example import:

import org.springframework.web.bind.annotation.RestController;

## Expected behavior

The Java language server should either:

1. Honor maven.pomfile.globPattern, or
2. Provide a Java setting such as java.import.maven.pomfile.globPattern, or
3. Support custom Maven POM file names when Maven for Java has already discovered them.

## Actual behavior

Maven Explorer can discover the custom POM, but JDT LS / Red Hat Java does not import the project classpath unless the build file is named pom.xml.

## Environment

- VS Code
- Extension: redhat.java version 1.55.0
- Extension: vscjava.vscode-maven version 0.45.3
- Java: 21
- Maven project file: pom-customize.xml
- No pom.xml in project root

## Workarounds tried

- maven.pomfile.globPattern
- maven.executable.options: -f pom-customize.xml
- .mvn/maven.config with -f pom-customize.xml

These help Maven commands/explorer, but do not fix Java language server diagnostics.

贡献指南

打开贡献指南

从这里开始

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

调研方向

仅使用 pom-customize.xml 在 VS Code 中重现该项目,并比较 Maven Explorer 的发现机制与 JDT LS / Red Hat Java 的类路径导入。从 Java 语言服务器的 Maven 导入器以及 maven.pomfile.globPattern 的行为入手;自定义 POM 被导入且 RestController 诊断消失时,即视为完成。

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

评估

技术栈
java, vscode
领域
build-system, developer-experience, devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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