Last active
May 17, 2018 11:14
-
-
Save raphaeladrien/435e26f2132d2559646cad8af7004646 to your computer and use it in GitHub Desktop.
Example gradle kotlin + spring boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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