overlay function of gretty configuration adds the specified project as an overlay source to the current project.

Syntax

gretty {
  // ...
  overlay ':overlay1'
  overlay ':overlay2'
  // ...
}

Effects

  1. When performing appRun[Debug] and appStart[Debug], runtime classpath of overlay sources is added to the runtime classpath of the current project. Classpath of the current project has priority.

  2. When assembling WAR file, the compiled resources and classes of the overlay sources are added (overlayed) to the current project. The files of the current project have priority over overlay source files. This allows to effectively customize web-app.

Tip
You can specify more than one overlay source.
Tip
You can specify recursive overlay sources - that is, the projects, added by overlay function, can contain gretty configuration with overlay referencing other projects and so on.
Important
"overlay" property "understands" only gradle projects of the same project tree as an input. You can not specify maven artifacts as overlay sources.

Gretty sources contain example programs, demonstrating use of overlays: