I would like to enable Explicit API mode for my Kotlin project. However, I cannot find a way how to do it. On the site, I can see only gradle
based configuration:
kotlin {
// for strict mode
explicitApi()
// or
explicitApi = ExplicitApiMode.Strict
}
I believe that you're using kotlin-maven-plugin
, so you can pass additional arguments to compiler like this
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>...</executions>
<configuration>
<args>
<arg>-Xexplicit-api=strict</arg> <!-- Enable explicit api mode -->
...
</args>
</configuration>
</plugin>
more info can be found here: https://kotlinlang.org/docs/reference/using-maven.html#specifying-compiler-options