Skip to content

Commit aa1466d

Browse files
authored
feat: add how to enable kapt with K2 compiler (#4639)
1 parent d10799f commit aa1466d

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

docs/topics/kapt.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,28 @@ Follow these steps:
7878
{style="warning"}
7979

8080
From Kotlin 1.9.20, you can try using the kapt compiler plugin with the [K2 compiler](https://blog.jetbrains.com/kotlin/2021/10/the-road-to-the-k2-compiler/),
81-
which brings performance improvements and many other benefits. To use the K2 compiler in your project, add the following
82-
options to your `gradle.properties` file:
81+
which brings performance improvements and many other benefits. To use the K2 compiler in your Gradle project, add the following
82+
option to your `gradle.properties` file:
8383

8484
```kotlin
8585
kapt.use.k2=true
8686
```
8787

88+
If you use the Maven build system, update your `pom.xml` file:
89+
90+
```xml
91+
<configuration>
92+
...
93+
<args>
94+
<arg>-Xuse-k2-kapt</arg>
95+
</args>
96+
</configuration>
97+
```
98+
99+
> To enable the kapt plugin in your Maven project, see [](#use-in-maven).
100+
>
101+
{style="tip"}
102+
88103
If you encounter any issues when using kapt with the K2 compiler, please report them to our
89104
[issue tracker](http://kotl.in/issue).
90105

@@ -370,6 +385,17 @@ For example:
370385
</configuration>
371386
```
372387

388+
To enable the kapt plugin with the K2 compiler, add the `-Xuse-k2-kapt` compiler option:
389+
390+
```xml
391+
<configuration>
392+
...
393+
<args>
394+
<arg>-Xuse-k2-kapt</arg>
395+
</args>
396+
</configuration>
397+
```
398+
373399
## Use in IntelliJ build system
374400

375401
kapt is not supported for IntelliJ IDEA's own build system. Launch the build from the "Maven Projects"

0 commit comments

Comments
 (0)