New to Kotlin? We recommend checking out Kotlin
Koans to get up to speed.
Local development
To run the code for your challenge locally, you’ll needmvn installed. Our test runners use mvn version 3.9.5 (as of November 2023).
The script for your challenge (like ./your_bittorrent.sh) will automatically compile your code using mvn package before executing it.
File structure
- The files for your solution are placed in the
src/main/kotlindirectory. src/main/kotlin/Main.ktcontains themainfunction, which is what the test runner executes.
Adding more files
You can add more files and directories tosrc/main/kotlin. The test runner will include them when compiling your code.
For example, if you added a file at src/main/kotlin/Foo.kt, you could use it like so:
src/main/kotlin are in the default package. If you want to extract files into a different package,
you’ll need to add a package declaration to the top of the file.
Let’s say you wanted to extract Foo.kt into the com.example.foo package. You’d add the following to the top of Foo.kt:
Adding dependencies
You can add dependencies to your project by adding them to yourpom.xml file.
For example, to add the gson library, add the following to the <dependencies> section in your pom.xml: