Warnings as errors using Maven?


#1

In 1.2.0 there is a nice new option for the Kotlin compiler to treat all warnings as errors. In the release-notes there is a Gradle example enabling this. How can I do this if I’m using Maven?


#2

You can pass arbitrary compiler arguments to the Kotlin maven plugin in its configuration block:

            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <version>${kotlin.version}</version>
                <!-- ... -->
                <configuration>
                    <args>
                        <arg>-Werror</arg>
                    </args>
                </configuration>
            </plugin>

#3

Perfect, thanks!