Search code examples
gradlegretty

Upgrading from gretty 3.0.1 to 3.0.7 causes error could not get unknown property 'mainClass'


I am currently running gradle version 5.6.4. When trying to upgrade our gretty dependency from 3.0.1 to 3.0.5 or 3.0.7, I am running into this error with no other information:

Exception in thread "Thread-65" groovy.lang.MissingPropertyException: Could not get unknown property 'mainClass' for object of type org.gradle.process.internal.DefaultJavaExecAction_Decorated.
        at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:87)

Solution

  • tl;dr Upgrade your gradle version to 6.9.2

    Turns out that there is an undocumented breaking change between gretty versions 3.0.1 to 3.0.5 that the minimum gradle version required in your application is gradle 6.x.

    I originally tried upgrading to gradle version 6.0.1 which had the same error, then I jumped straight to the latest 6.x version (6.9.2) and that now works.