redhat-developer / redhat-developer/vscode-java

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

Open
#4,455 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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.

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 the project in VS Code with only pom-customize.xml and compare Maven Explorer discovery with JDT LS / Red Hat Java classpath import. Start at the Java language server's Maven importer and the maven.pomfile.globPattern behavior; done when the custom POM is imported and the RestController diagnostic disappears.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
build-system, developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.