redhat-developer / redhat-developer/vscode-java
Handle module projects with separate module-info.java for main and test sources
@testforstephen is already working on this.
Since Sep 26, 2021.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
Here is a Java 11 maven module project: https://github.com/microsoft/gctoolkit. The project is a multi-module maven project. One submodule is "api", see its file structure as follows. It describes the module-info.java file in the main sources and the test sources respectively.
api
├───src
│ ├───main
│ │ ├───java
│ │ │ │ module-info.java
│ │ │ └───com.microsoft.gctoolkit
│ │ │ GCToolKit.java
│ └───test
│ ├───java
| | | module-info.java
│ │ └───com.microsoft.gctoolkit.test
│ │ Test.java
However, when opening this project in VS Code, it doesn't work. It reports a compile error: "The project was not built due to "Build path contains duplicate entry: 'module-info.java' for project 'api'". Fix the problem, then try refreshing this project and building it since it may be inconsistent". It doesn't support multiple module-info.java files in one Java project.

The same project works in maven command line. There should be some gap in the JDT compiler that needs to be fixed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.