Extension for the kotlin-maven-plugin
to support Kotlin Symbol Processing (KSP).
To use this extension, add the dependency to the kotlin-maven-plugin
:
<dependency>
<groupId>com.dyescape</groupId>
<artifactId>kotlin-maven-symbol-processing</artifactId>
<version>${ksp.version}</version>
</dependency>
You can find the latest version here.
Then configure the kotlin-maven-plugin
to use the ksp
compiler plugin:
<configuration>
<compilerPlugins>
<compilerPlugin>ksp</compilerPlugin>
</compilerPlugins>
</configuration>
To now add a symbol processor, simply add the module containing the symbol processor provider to the dependencies
of
the kotlin-maven-plugin
.
The releases for this project are published to the central maven repository.
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<compilerPlugins>
<compilerPlugin>ksp</compilerPlugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>com.dyescape</groupId>
<artifactId>kotlin-maven-symbol-processing</artifactId>
<version>${ksp.version}</version>
</dependency>
<dependency>
<groupId><!-- symbol processor group id --></groupId>
<artifactId><!-- symbol processor artifact id --></artifactId>
<version><!-- symbol processor version --></version>
</dependency>
</dependencies>
</plugin>
It is also possible to pass options to KSP by specifying them under pluginOptions
:
<pluginOptions>
<option>ksp:kotlinOutputDir=/my/output/dir</option>
</pluginOptions>
Options can also be passed to the actual annotation processors using the repeatable apoption
option:
<pluginOptions>
<option>ksp:apoption=key=value</option>
</pluginOptions>