Learn how to solve CodeCrafters challenges in Kotlin
mvn
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.
src/main/kotlin
directory.src/main/kotlin/Main.kt
contains the main
function, which is what the test runner executes.src/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
:
pom.xml
file.
For example, to add the gson library, add the following to the <dependencies>
section in your pom.xml
: