You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
@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...
@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.
Activity
martinlippert commentedon Feb 5, 2025
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.
BoykoAlex commentedon Mar 6, 2025
@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...
kmartin88 commentedon Mar 25, 2025
@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 installondemo-lib, then ondemo-pomand then importdemo-using-libas 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 pastecom.example.demo.DemoLibApplicationinto theMain typefield, it works.BoykoAlex commentedon Apr 3, 2025
Should be fixed via cc3aead (the lib project had to come from a jar and not be in the workspace)