Skip to content

Instantly share code, notes, and snippets.

@raphaeladrien
Last active May 17, 2018 11:14
Show Gist options
  • Save raphaeladrien/435e26f2132d2559646cad8af7004646 to your computer and use it in GitHub Desktop.
Save raphaeladrien/435e26f2132d2559646cad8af7004646 to your computer and use it in GitHub Desktop.
Example gradle kotlin + spring boot
buildscript {
ext {
kotlin_version = '1.2.41'
spring_boot_version = '2.0.1.RELEASE'
mockito_kotlin_version = '1.5.0'
}
repositories {
mavenCentral()
}
dependencies {
//kotlin
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}")
classpath("org.jetbrains.kotlin:kotlin-noarg:${kotlin_version}")
//spring
classpath("org.springframework.boot:spring-boot-gradle-plugin:${spring_boot_version}")
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'kotlin-noarg'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
dependencies {
// Kotlin
compile 'org.jetbrains.kotlin:kotlin-stdlib'
compile 'org.jetbrains.kotlin:kotlin-reflect'
//Spring
compile "org.springframework.boot:spring-boot-starter-web"
//Web module
compile "com.fasterxml.jackson.module:jackson-module-kotlin"
//Test
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'org.mockito:mockito-core'
testCompile "com.nhaarman:mockito-kotlin:${mockito_kotlin_version}"
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
sourceSets {
main.kotlin.srcDirs += 'src/main/kotlin'
}
jar {
manifest {
attributes("Implementation-Title": "Project name: ${project.name.capitalize()}")
}
baseName = 'teste'
}
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions.suppressWarnings = true
}
compileKotlin {
kotlinOptions {
suppressWarnings = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment