microsoft / microsoft/vscode-java-debug

Cannot find main method for Maven project with subprojects

Open
#1,006 5 comments 3 reactions 1 assignee View on GitHub

@testforstephen is already working on this.

Since Dec 1, 2021.

ai-triaged bug launch
Dominant language
TypeScript
Stars
591
Forks
429
Avg merge
1d 9h
Merged PRs (30d)
19

Description

Environment
  • Operating System: Arch Linux
  • JDK version: liberica-jdk-11-full
  • Visual Studio Code version: VSCodium 1.56.2
  • Java extension version: 0.77.0
  • Java Debugger extension version: 0.33.1
Steps To Reproduce

Given a Maven project with subprojects, such as this one
And VSCode is open with the cwd set to the root of the project
And I open a file in one of the subprojects (e.g. XChartDemo.java)
And the language server starts successfully
And I wait for long enough for the project to be loaded
When I try to run the main method

Current Result

Then I get an error message:

Error: Main method not found in the file, please define the main method as: public static void main(String[] args)

Source: Debugger for Java (Extension)
Expected Result

Then the main method is started

Log

lsp.log

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.