Getting the Project Files

We'll cover the following

We’ll write code in the unittests/airportapp directory—our project location for this example. Since setting up the build files often takes effort, we can save significant time by using a pre-created project structure. Download the source code zip file from the book’s website, unzip the file, and cd to the unittests/airportapp directory. Take a few minutes to study the project structure.

You’ll find the following empty directories: src/main/kotlin/com/agiledeveloper/airportstatus and src/test/kotlin/com/agiledeveloper/airportstatus. These are the default directory structures, for source files and test files, used by both Gradle and Maven build tools. So we can use this structure irrespective of which build tool we pick from those two.

In addition to the two empty directories, in the project directory you’ll also find files related to Gradle build and Maven build.

First, we have to pick either Gradle or Maven for the build tool. Maven is the more popular tool, while Gradle is the more pragmatic and lightweight tool. Depending on what you’re comfortable with or what’s used in projects you work on, feel free to make the appropriate choice.

If you choose to use Maven, skip the next subsection and proceed to Setting Up Maven. If you opt to use Gradle, read along.

Setting up Gradle

With Gradle you may either use Groovy DSL to create a build.gradle build file or the Kotlin DSL to create a build.gradle.kts build file. As you may guess, we’ll use the Kotlin DSL for Gradle in this chapter. You can use the readily provided build file from the airportapp project directory:

Get hands-on with 1200+ tech skills courses.