Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 4 upgrade - Error message unable to find a single main class

I am currently upgrading from Grails 3.3.10 to Grails 4.0.0. When attempting to run my project I get the following error:

 Execution failed for task ':bootRun'.
 15:31:02.101 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Unable to find a single main class from the following candidates [com.torque.Application, com.base.torque.ExtendedReportsController, com.base.torque.utils.NaturalOrderComparator]

Whether I try to run the project in my IDE or my terminal, I get the same error.

I uninstalled and reinstalled grails 4.0.0 and I still get the error. Tried ./gradlew clean, rebuilding, killall -9 java and still get the error.

This was not an issue with previous Grails versions. No clue what is causing the issue with Grails 4 and no clue how to solve. Any insight towards a solution would be appreciated.

like image 936
Rooky Coder Avatar asked Aug 19 '19 19:08

Rooky Coder


1 Answers

If you have multiple classes which contain a main method, you can disambiguate with something like this in your build.gradle:

springBoot {
    mainClassName = 'com.torque.Application'
}
like image 147
Jeff Scott Brown Avatar answered Oct 22 '22 06:10

Jeff Scott Brown