Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devtools does not support package-private main classes #35858

Closed
joshlong opened this issue Jun 13, 2023 · 1 comment
Closed

Devtools does not support package-private main classes #35858

joshlong opened this issue Jun 13, 2023 · 1 comment
Labels
type: bug A general bug
Milestone

Comments

@joshlong
Copy link
Member

joshlong commented Jun 13, 2023

No idea why this happens and the errors are sort of sporadic. either it won't start the app or it'll refuse to recompile things. I don't know. In all instances adding public to the class cntainign the main method fixes it. My ask is that either Devtools handles non public main classes or that the generated code on the Spring Initializr not generate classes that are packae private

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 13, 2023
@wilkinsona wilkinsona changed the title devtools fails when running against a main method in the test code (such as when using Testcontainers) when the class containing the method isn't public Devtools does not support package-private main classes Jun 13, 2023
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 13, 2023
@wilkinsona wilkinsona added this to the 2.7.x milestone Jun 13, 2023
@wilkinsona
Copy link
Member

The problem seems to be specific to Devtools as a package-private main class with a public main method can be launched in an IDE and can also be launched using java -jar.

org.springframework.boot.devtools.restart.MainMethod finds the main method on the package-private class but org.springframework.boot.devtools.restart.RestartLauncher cannot invoke it. For consistency, the method should be made accessible as org.springframework.boot.loader.MainMethodRunner already does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants