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

The purpose and syntax of "tomcat.xml" is documented in Tomcat configuration reference.

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

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

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

If serverConfigFile is not specified, Gretty looks for one of the files: "tomcat8.xml" (for Tomcat 8), "tomcat7.xml" (for Tomcat 7), "tomcat.xml", "tomcat8-server.xml" (for Tomcat 8), "tomcat7-server.xml" (for Tomcat 7), "server.xml". Tomcat version is defined by gretty.servletContainer property.

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

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

  • "$project.projectDir/tomcat"

  • "$project.projectDir/server"

  • "$project.projectDir/config"

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

When you generate a product, "tomcat.xml" file is automatically copied to "conf" subdirectory and referenced in "conf/server.json". The running product automatically applies "tomcat.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 configurations.

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

See also: