# Configure Kotlin compiler for your Maven project The `kotlin-maven-plugin` allows you to configure the Kotlin compiler for your Maven projects. You can specify compiler options, choose an execution strategy, and enable incremental compilation. ## Specify compiler options You can specify additional options and arguments for the compiler as elements in the `` section of the Kotlin Maven plugin node: ```XML org.jetbrains.kotlin kotlin-maven-plugin ${kotlin.version} true ... true -Xjsr305=strict ... ``` Many of the options can also be configured through properties: ```XML 2.4 ``` The following attributes are supported: ### Attributes specific to JVM | Name |Property name |Description |Possible values |Default value | -------------------------------------------------------------------- | `nowarn` | |Generate no warnings |true, false |false | | `languageVersion` |`kotlin.compiler.languageVersion` |Provide source compatibility with the specified version of Kotlin |"2.0", "2.1", "2.2", "2.3", "2.4", "2.5" (EXPERIMENTAL) | | | `apiVersion` |`kotlin.compiler.apiVersion` |Allow using declarations only from the specified version of bundled libraries |"2.0", "2.1", "2.2", "2.3", "2.4", "2.5" (EXPERIMENTAL) | | | `sourceDirs` | |The directories containing the source files to compile | |The project source roots | | `compilerPlugins` | |Enabled compiler plugins | |[] | | `pluginOptions` | |Options for compiler plugins | |[] | | `args` | |Additional compiler arguments | |[] | | `jvmTarget` |`kotlin.compiler.jvmTarget` |Target JVM version of the generated bytecode. Controls only the bytecode version of the output and does not restrict which JDK APIs your code can use. |"1.8", "9", "10", ..., "26" |"1.8" | | `jdkRelease` |`kotlin.compiler.jdkRelease` |Target JVM version. Controls the bytecode version and limits the available API to the specified JDK version, preventing accidental use of newer APIs. Equivalent to Java's `--release` compiler option. |"1.8", "9", "10", ..., "26" | | | `jdkHome` |`kotlin.compiler.jdkHome` |Include a custom JDK from the specified location into the classpath instead of the default `JAVA_HOME` | | | | `jdkToolchain` |`kotlin.compiler.jdkToolchain` |Set the JDK version to use from the toolchain. Only affects Kotlin compilation | | | | `-Xadd-modules` | |(Experimental) Resolve the specified root modules in addition to the initial modules. Set the `ALL-MODULE-PATH` value to resolve to all modules on the module path. |Comma-separated module names or `ALL-MODULE-PATH` passed through `` | | Keep in mind how the JVM-specific options interact with each other: * If you don't set `jvmTarget` explicitly, the Kotlin Maven plugin uses the `jdkRelease` value, or the default `1.8` version if `jdkRelease` isn't set either. * The JDK that the compiler uses is defined by the `jdkHome` option. If you don't set `jdkHome` explicitly, the Kotlin Maven plugin passes the toolchain's JDK to the compiler as `jdkHome`. You can specify the [toolchain's JDK](maven-configure-project.html#set-jdk-version) in the `maven-toolchains-plugin` or the `jdkToolchain` option. An explicit `jdkHome` value always takes precedence over the toolchain. * Neither the `jdkHome` option nor the toolchain affects the `jvmTarget` option. ## Choose execution strategy By default, Maven uses the Kotlin daemon compiler execution strategy. To switch to the "in process" strategy, set the following property in your `pom.xml` file: ```XML false ``` For more information about the different strategies, see [Compiler execution strategy](compiler-execution-strategy.html). ## Enable incremental compilation To make your builds faster, you can enable incremental compilation by adding the `kotlin.compiler.incremental` property: ```XML true ``` Alternatively, run your build with the `-Dkotlin.compiler.incremental=true` option. ## Explore available goals and parameters In your IDE, you can navigate from the Kotlin Maven plugin declaration in your `pom.xml` file to the generated plugin descriptor, which contains information about the available goals and their parameters. You can also use the standard Maven Help plugin from the command line to get this information. From the directory that contains your project's `pom.xml` file, run: ```BASH mvn help:describe \ -Dplugin=org.jetbrains.kotlin:kotlin-maven-plugin \ -Ddetail=true ``` The output lists every available goal along with detailed information about its parameters. To get the description of a specific goal, add the `-Dgoal` option. For example, for the `compile` goal, run: ```BASH mvn help:describe \ -Dplugin=org.jetbrains.kotlin:kotlin-maven-plugin \ -Ddetail=true \ -Dgoal=compile ``` ## What's next? [Package your project](maven-compile-package.html)