Skip to content
loading...

How do you get started with Kotlin (not for Android), or init a project?

patarapolw profile image Pacharapol Withayasakpunt twitter logo github logo ・1 min read

I came from Android, so I use gradle.

brew install gradle
mkdir project && cd project
gradle init  # choose application, kotlin and groovy DSL
# Open the project in IntelliJ

But recently, I see that Maven is quite good, and might be more simple, although I don't like the looks of XML (pom.xml) (but can I adapt.)

Also, do you use IntelliJ or VSCode, or something else? I am starting to migrate from IntelliJ to VSCode...

Also, what to you put in .gitignore? Gradle init suggests,

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

But https://www.gitignore.io/ is more complex -- https://www.gitignore.io/api/kotlin

Still, I have to manually add

!/lib/**/*.jar
/bin/
/build/
/.gradle/
twitter logo DISCUSS (5)
Discussion
markdown guide
 

I use IDEA's project generator, picking Gradle with Kotlin extensions, if I have no other way to create a project.

I did create a project template using the kickstart tool, which is now stored in my internal git, and allows me to quickly create a project with a gitignore, editorconfigs, and such.

 

What kind of Kotlin project are you doing?

Diane's tip about using IDEA's project generator is good.

If you are doing Spring Boot, use start.spring.io/

If you want to do something else, look whether they have a sample respository, that's usually a fastest way to get started

 

I usually dislike boilerplate, so I use Javalin. (used to use Spark Java).

Another kind I usually do is a desktop app. I have made some libraries (and uploaded to Maven) as well.

Maybe I should learn boilerplate-esque, like Spring Boot, Django, Nest.js... (Still, I am OK with Nuxt, Vue CLI, but not Quasar)

 
Classic DEV Post from Jul 30 '19

PublishTo.Dev: Scheduling article publishing on dev.to

Pacharapol Withayasakpunt profile image
Currently interested in TypeScript, Vue, Kotlin and Python. Looking forward to learning DevOps, though.