When organizing Gretty farms in real life, you are likely to face two problems:

  • web-apps are not subprojects of farm project

  • you do not want all web-apps to be started, only subset of them

For such cases you’ll need to define farm configuration. Edit the file "ProjectA/build.gradle", insert code:

farm {
  webapp ':ProjectA'
  webapp ':ProjectB'
}

Here we define that default farm includes two projects - ProjectA and ProjectB. As soon as we start farm tasks, both projects will run on the same servlet-container with distinct context paths.

See also: Multiple web-apps.