No such property: mainClassName error in gradle build

FAILURE: Build failed with an exception.
I am trying to figure out why in the middle of the build this is suddenly happening for my project that I did not tamper with. Basically, what does that error message mean in terms of figuring out where the problem is?

  • Where:
    Build file ‘/Users/joejung//Libraries//build.gradle’ line: 6

  • What went wrong:
    A problem occurred evaluating project ‘:Libraries:********’.

No such property: mainClassName for class: org.gradle.api.internal.project.DefaultProject_Decorated

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

At line 6 of your Libraries Gradle project, you try to read ‘mainClassName’ and this property is not defined /accessible from this project

Give us your build.gradle if you need more help.

If I had to bet, you’d like to use the gradle application plug-in (it creates a property named mainClassName) but this plugin is not applied to your Libraries Gradle project


apply plugin: ‘application’

to every single build.gradle of my sub projects evaded building error problem. Now I got another error about mainClassName not present, but also, my sub projects all specify that.