When applying Gretty 3.0.4 via the plugins {} block only to a Gradle 7.0.2 project sub-module, the following error is thrown:
An exception occurred applying plugin request [id: 'org.gretty', version: '3.0.4']
> Failed to apply plugin 'org.gretty'.
> Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.
- The same crash does not occur if the Gretty plugin is applied only to the root project.
- The same crash does not occur if the Gretty plugin is applied to both the root project and sub-project.
- The crash does occur if the Gretty plugin is applied to the root project with
apply false and applied to the sub-project.
In brief; it looks like the Gretty plugin must be fully applied to the root project to work. This seems an unintended and unreasonable restriction.