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.
Problem
A Maven Java project uses
pom-customize.xmlinstead ofpom.xml.Maven itself works: