redhat-developer / redhat-developer/vscode-java

Maven project inside another maven project not recognized

Open
#3,240 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When you have a maven project inside another maven project, only the top level project is properly recognized in the java projects view. However, if the sub-project is opened in another window by itself, the project is properly recognized

Environment
  • Operating System: Fedora 38
  • JDK version: openjdk 17.0.7
  • Visual Studio Code version: 1.81.0
  • Java extension version: 1.21.0
Steps To Reproduce
  1. Create new maven project (using maven for java extension)
  2. Create new maven project inside project from step 1. Example structure below:
test_project/
    src/
        main/
             java/
                TestMain.java
    pom.xml
    sub_project/
        src/
            main/
                java/
                    SubMain.java
        pom.xml
  1. Import Java Projects into Workspace
  2. Observe only test_project is properly imported in this case
  3. Open a new window: File > New Window
  4. Inside new window, open sub_project: File > Open Folder > select sub_project
  5. Observe sub_project can now be recognized as a java project
Current Result

Only top level projects are recognized, projects inside projects are not. This leads to the warning SubMain.java is not on the classpath of project test_project, only syntax errors are reported and many features of the extension not working

Expected Result

Projects are recursively detected by their pom files and the extension features can be used for projects inside projects

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 workspace using the nested pom.xml files described in the issue, then compare Import Java Projects with opening sub_project alone. Start by tracing the project-import entry point and how the extension discovers pom.xml files. Done means nested projects are recognized recursively and SubMain.java no longer reports that it is outside the classpath.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.