https://kotlinlang.org logo
Title
p

Pat

09/27/2018, 7:28 AM
I am really new to Kotlin, coming from PHP. All the tutorials that I've seen so far tell me to use Gradle or Maven, but I don't really understand why I need them. The docs are pretty bad, they don't really explain what it does or why I need it, they just explain how to set it up. This is probably because I come from PHP, I don't think there is an equivalent thing there. Can someone shed some light for me on why I need Gradle/Maven and what they actually do?
s

spand

09/27/2018, 7:30 AM
Do you know what a build system is?
t

Tsvetozar Bonev

09/27/2018, 7:31 AM
Gradle and Maven are build tools that help you package your application and also manage the libraries that you're going to be using in that application. When your code is done and you want to make it into an executable .jar you can configure it in one place and have it do the dirty work for you. When you want to use a library you add a dependency and gradle/maven will handle the transient dependencies that that library brings with it, they're pretty handy.
d

diesieben07

09/27/2018, 7:31 AM
PHP is interpreted. You just throw your php files at it and it runs them. Kotlin needs to be compiled by the Kotlin compiler for the JVM to be able to execute it. A build system manages this for you. It also manages your dependencies (like composer in the PHP world).
👆 1
p

Pat

09/27/2018, 7:37 AM
Thanks, that makes a lot of sense. Does it matter whether I learn Maven or Gradle? Which one is used more in the Kotlin ecosystem?
s

spand

09/27/2018, 7:40 AM
I think Gradle is the only supported option going forward. All of the jetbrains projects have been converted from maven to gradle.
d

diesieben07

09/27/2018, 7:42 AM
I doubt Maven support will be ditched completely, but certain features (like multiplatform projects) are probably not happening outside of Gradle.
For a start though you do not really need to learn it and can just go with the autogenerated project from IntelliJ.
a

Andreas Sinz

09/27/2018, 8:09 AM
gradle is roughly composer
🎼 2