Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (37 sloc) 1.37 KB
layout title author date permalink summarytitle summary language
tutorial
Setting up Javalin with Gradle
<a href="https://www.linkedin.com/in/davidaase" target="_blank">David Åse</a>
2017-05-24
/tutorials/gradle-setup
Gradle setup
Set up a Javalin project using Gradle in IntelliJ IDEA
kotlin

When you're done with this tutorial, your build.gradle file should look like this:

group 'io.javalin' // your group id
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile 'io.javalin:javalin:{{site.javalinversion}}'
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

Step by step instructions

  • File -> New -> Project
  • Select Gradle then Java (or Kotlin), click Next
  • Enter groupId and artifactId, click Next
  • Check Use auto-import, click Next

Open the newly generated build.gradle file and add the gradle-dependency \ compile 'io.javalin:javalin:{{site.javalinversion}}' to the dependencies {} scope. See the full build.gradle example above if you're not sure where to put it.

Finally, create a file src/main/java/HelloWorld.java or src/main/kotlin/HelloWorld.kt\ and paste the Hello World example:

{% include macros/gettingStarted.md %}

Now everything is ready for you to start programming. Enjoy!