Kotlin Plugin

Generates Kotlin code from your Taxi project


The Kotlin Plugin generates Kotlin classes, annotated with @DataType. This makes referencing taxi types in services more typesafe and robust.

What's generated

Scalar & Primitive types

Primitive and Scalar (types without properties) are output as kotlin type alias types, with a corresponding @DataType annotation

Model types

model types in Taxi (or types that contain properties) will generate a kotlin data class. with a corresponding @DataType annotation


Enums in Taxi are output as kotlin enumclasses


outputPathDefines where the generated kotlin code is written. This is relative to the output parameter in the main project configkotlin
kotlinVersionThe version of kotlin to use. Defines the Maven dependencies that are generated1.3.50
kotlinLanguageVersionThe kotlin language version. Corresponds to the languageVersion property in Kotlin's configuration.1.3
jvmTargetWhich version of the JVM to target. Defaults t1.8
mavenDefines the properties used for Maven configuration. If omitted, a pom.xml file is not generated.-
taxiVersionThe version of the taxi to depend onThe same version as the compiler being used.

For more details see the KotlinPluginConfig class.

Generating a Maven pom.xml

The plugin will optionally generate a Maven pom.xml file, to allow you to then compile and publish a jar file containing the generated artifacts.

The plugin will generate a valid pom.xml file, but doesn't attempt to run maven to compile the generated code. That's left to you, or your build server configuration.

The following properties can be configured, which relate to the same concepts in a maven pom.xml file:

  • groupId (defaults to the organisation name within the taxi project)
  • artifactId (defaults to the project name within the taxi project)
  • dependencies
  • repositories
  • distribution management
NameUsageDefault value
groupIdThe maven groupId in the generated outputThe groupId of the taxi project
artifactIdThe maven artifactId in the generated outputThe project name of the taxi project
dependenciesConfigures additional maven dependencies in the output maven pom. Generally, this isn't required. Kotlin and Taxi dependencies are included by defaultKotlin and Taxi dependencies
repositoriesConfigures additional repositories to download dependencies from. Use this if you have an internal maven repository server that operates as a corporate proxy to Maven centralOmitted
distributionManagementDefines where generated jar files are published using mavens deploy commandOmitted

Sample Configuration

name: taxi/maven-sample
version: 0.3.0
sourceRoot: src/
plugins: {
   taxi/kotlin: {
      maven: {
         groupId: "lang.taxi"
         artifactId: "parent"
         repositories: [
               id: "internal-repo"
               url: "https://newcorp.nexus.com"
               snapshots: true
         distributionManagement: {
            id: "some-internal-repo"
            url: "https://our-internal-repo"
Edit on Github