Appendix A. Building Kotlin projects
This appendix explains how to build Kotlin code with Gradle, Maven, and Ant. It also covers how to build Kotlin Android applications.
The recommended system for building Kotlin projects is Gradle. Gradle is the standard build system for Android projects, and it also supports all other kinds of projects where Kotlin can be used. Gradle has a flexible project model and delivers great build performance thanks to its support for incremental builds, long-lived build processes (the Gradle daemon), and other advanced techniques.
The Gradle team is working on the support for writing Gradle build scripts in Kotlin, which will allow you to use the same language for writing your application and its build scripts. As of this writing, this work is still in progress; you can find more information about it at https://github.com/gradle/gradle-script-kotlin. In this book, we use Groovy syntax for Gradle build scripts.
The standard Gradle build script for building a Kotlin project looks like this:
- src/main/java and src/main/kotlin for the production source files
- src/test/java and src/test/kotlin for the test source files