Skip to content

Main class outside project not found #1437

Closed

Description

@kmartin88

Describe the bug
I am using STS4 for Eclipse and I have a project in my workspace which uses a custom framework on top of Spring Boot. The main class is not contained in the project directly but is located inside this custom framework.
The project shows up in the boot dashboard, even if I check "Hide local non-runnable apps" in the filter.
However, the default run configuration created by the Boot Dashboard does not contain a main class which leads to "Error: Could not find or load main class".
When I edit the run configuration (click on Open Config in the context menu) and then click on the "Search..." button next to "Main type" the main class doesn't show up.
It works perfectly fine if I just put in the fully qualified name of the main class myself. It just doesn't seem to be able to find the class by itself.

Is this a bug or intended behaviour (meaning does it only look inside the project sources for a main class instead of the whole class path)?
In the case of a bug I can try to build a little sample to reproduce it as I can't show you the original because it's a customer project.

Activity

  1. martinlippert commented on Feb 5, 2025

    @martinlippert
    Member

    Sorry for the late reply, I somehow totally missed this one. Apologies. Sounds like what you describe should totally be possible and if this does not work (whether it is a bug or not), we should try to improve this for sure.

  2. added this to the 4.29.0.RELEASE milestone on Feb 5, 2025
  3. BoykoAlex commented on Mar 6, 2025

    @BoykoAlex
    Contributor

    @kmartin88 any chance you can assemble and share a small example application that demonstrates the issue?
    I've tried having 2 boot apps: one with main class and the other without the main class where the app with the main class is a dependency for the app without the main class.
    If I attempt to start the app without with the main class it launches main class from the dependency project. It also finds the main class in the launch config UI. If i hide non-runnable apps the app without the main class is hidden though... Other than that it seems to behave as expected hence I'm curious about how your projects are setup...

  4. kmartin88 commented on Mar 25, 2025

    @kmartin88
    Author

    @BoykoAlex Sorry, I didn't have time for this until now.

    I just created 3 projects, one Spring Boot, one with pom packaging having the first as dependency and a third one having the pom one as parent. You can find them here

    You just need to do mvn clean install on demo-lib, then on demo-pom and then import demo-using-lib as a new maven project in a new workspace and should see the problem. It shows the project in the Boot Dashboard but there is no main type and it can't be found when clicking on "Search...". If you just paste com.example.demo.DemoLibApplication into the Main type field, it works.

  5. BoykoAlex commented on Apr 3, 2025

    @BoykoAlex
    Contributor

    Should be fixed via cc3aead (the lib project had to come from a jar and not be in the workspace)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsetheme: boot-dashboardtype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions