Skip to content

Instantly share code, notes, and snippets.

@carolosf
Last active November 20, 2017 18:21
Show Gist options
  • Save carolosf/434d75de0505453b59952a4d4d510348 to your computer and use it in GitHub Desktop.
Save carolosf/434d75de0505453b59952a4d4d510348 to your computer and use it in GitHub Desktop.
Example gradle build file using kotlin dsl
// Gradle version 4.3.1 and kotlin dsl 0.12.3
// Kotlin 1.1.60
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.Coroutines
group = "com.example"
version = "1.0-SNAPSHOT"
buildscript {
val kotlinVersion: String by extra { "1.1.60" }
val junitPlatformVersion: String by extra { "1.0.2" }
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("org.junit.platform:junit-platform-gradle-plugin:$junitPlatformVersion")
}
}
repositories {
mavenCentral()
jcenter()
maven {
setUrl("https://dl.bintray.com/kotlin/exposed")
}
maven {
setUrl("https://dl.bintray.com/kotlin/ktor")
}
maven {
setUrl("https://dl.bintray.com/kotlin/kotlinx")
}
}
plugins {
application
java
kotlin("jvm") version "1.1.60"
}
apply {
plugin("org.junit.platform.gradle.plugin")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
application {
mainClassName = "web.MainKt"
}
kotlin {
experimental.coroutines = Coroutines.ENABLE
}
val kotlinVersion: String by extra { "1.1.60" }
val junitPlatformVersion: String by extra { "1.0.2" }
val junitJupiterVersion: String by extra { "5.0.2" }
val commonsLoggingVersion: String by extra { "1.2" }
val slf4jVersion: String by extra { "1.7.21" }
val logbackVersion: String by extra { "1.1.7" }
val fuelVersion: String by extra { "1.12.0" }
val exposedVersion: String by extra { "0.9.1" }
val ktorVersion: String by extra { "0.9.0" }
val h2Version: String by extra { "1.4.196" }
dependencies {
compile(kotlin("stdlib-jre8", kotlinVersion))
compile("commons-logging:commons-logging:$commonsLoggingVersion")
compile("org.slf4j:slf4j-api:$slf4jVersion")
compile("ch.qos.logback:logback-classic:$logbackVersion")
compile("com.github.kittinunf.fuel:fuel:$fuelVersion")
compile("org.jetbrains.exposed:exposed:$exposedVersion")
compile("io.ktor:ktor-server-core:$ktorVersion")
compile("io.ktor:ktor-server-netty:$ktorVersion")
// compile(kotlin("reflect", kotlinVersion))
// testCompile(kotlin("test", kotlinVersion))
// testCompile(kotlin("test-junit", kotlinVersion))
testCompile("org.junit.platform:junit-platform-runner:$junitPlatformVersion")
testCompile("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
testCompile("com.h2database:h2:$h2Version")
testRuntime("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
task<Wrapper>("wrapper") {
gradleVersion = "4.3.1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment