"jetty.xml" is the configuration file for Jetty (for server itself, not for web-app).

The purpose and syntax of "jetty.xml" is documented in Jetty reference.

Gretty recognizes and supports "jetty.xml". As soon as Gretty finds existing "jetty.xml" file, it reads the file and uses it to configure jetty server. Even if "jetty.xml" is not found, Gretty still works.

You can (but you don’t have to) specify "jetty.xml" file via property "serverConfigFile" in Gretty configuration:

gretty {
  // ...
  serverConfigFile = 'someFile.xml'
  // ...

If explicitly defined serverConfigFile represents an absolute path, gretty will use just that.

If serverConfigFile is not specified, Gretty looks for one of the files "jetty9.xml" (for Jetty 9), "jetty8.xml" (for Jetty 8), "jetty7.xml" (for Jetty 7), "jetty.xml". Jetty version is defined by gretty.servletContainer property.

If implicitly or explicitly defined serverConfigFile represents a relative path, gretty tries to resolve it in the following directories:

  • "$project.projectDir/jetty"

  • "$project.projectDir/server"

  • "$project.projectDir/config"

  • recursively in the abovementioned folders of the overlay sources (if any)

When you generate a product, "jetty.xml" file is automatically copied to "conf" subdirectory and referenced in "conf/server.json". The running product automatically applies "jetty.xml" files listed in "conf/server.json".

When you run a farm or generate product from a farm, serverConfigFile is taken from farm or product configuration, not from gretty configuration.

Gretty sources contain example program demonstrating support of "jetty.xml" at work:

See also: