anchor.diff:      }
   ----
   
  +The following example shows environments being configured using the Kotlin DSL.
  +
  +[source,groovy]
  +[subs="attributes"]
  +.build.gradle.kts
  +----
  +    extra["downloadsDir"] = project.findProperty("downloads.dir") ?: "${rootDir}/downloads"
  +    extra["java7Home"] = project.findProperty("java7.home") ?: "/opt/jdk1.7.0_80"
  +    extra["java8Home"] = project.findProperty("java8.home") ?: "/opt/jdk1.8.0_144"
  +
  +
  +    teamcity {
  +        version = "{example-api-version}"
  +
  +        server {
  +            descriptor = file("teamcity-plugin.xml")
  +        }
  +
  +        environments {
  +            baseDownloadUrl = "http://repository/"
  +            downloadsDir = extra["downloadsDir"] as String
  +            baseHomeDir = "teamcity/servers"
  +            baseDataDir = "${rootDir}/data"
  +
  +            operator fun String.invoke(block: TeamCityEnvironment.() -> Unit) {
  +                environments.create(this, closureOf<TeamCityEnvironment>(block))
  +            }
  +
  +            "teamcity9" {
  +                version = "9.1.7"
  +                javaHome = file(extra["java7Home"])
  +
  +                // Add to the default server options
  +                serverOptions("-Dproperty=value")
  +                serverOptions("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5500")
  +            }
  +
  +            "teamcity2017.1" {
  +                version = "2017.1.4"
  +                javaHome = file(extra["java8Home"])
  +
  +                // Replace the default server options
  +                setServerOptions("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5500")
  +            }
  +        }
  +    }
  +----
  +
   ### TeamCity Agent Plugin
   
   The plugin when applied with the Java Plugin, adds the JetBrains Maven repository and adds the TeamCity agent-api and
  
positive.code:     }
  ----
  
  ### TeamCity Environments Configuration
  
  The environments configuration is available by applying the `com.github.rodm.teamcity-server` plugin.
  
negative.code:                     from('tooldir')
                  }
              }
          }
      }
  ----
  
  The following example uses the Kotlin DSL.
  
  [source,groovy]
  [subs="attributes"]
  .build.gradle.kts
  ----
      extra["teamcityVersion"] = findProperty("teamcity.version") ?: "10.0"
  
      teamcity {
          version = extra["teamcityVersion"] as String
  
          agent {
              descriptor {
                  pluginDeployment {
                      useSeparateClassloader = false
                      executableFiles {
                          include("file1")
                          include("file2")
                      }
                  }
                  dependencies {
                      plugin("plugin-name")
                      tool("tool-name")
                  }
              }
  
              files(closureOf<CopySpec> {
                  into("tooldir") {
                      from("tooldir")
                  }
              })
          }
      }
  ----
  