Ok, so I'm new to Gradle and Kotlin and I am having a hard time understanding how things glue together here...
I need to configure a project that should run on Java 7 (client limitations -_-) and I want to use Kotlin with it.
Right now I have the following build.gradle file that is working but I want to ask a few things that I couldn't find anywhere else:
buildscript {
ext {
springBootVersion = '1.5.15.RELEASE'
kotlin_version = '1.1.1'
}
repositories {
mavenCentral()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
group = 'com.springkotlin'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-security')
compile('com.onelogin:java-saml:2.3.0')
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
runtime('org.springframework.boot:spring-boot-devtools')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.security:spring-security-test')
testCompile group: 'javax.inject', name: 'javax.inject', version: '1'
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.6"
}
}
Now the questions:
I have tried using
kotlin_version = '1.2.70'(released last few days!) and I got the errorKotlinPluginWrapper : Unsupported major.minor version 52.0. I'm guessing then this is due to Kotlin 1.2.X only being able to "compile" (is that the word?) with Java 8+. Is that right? Is1.1.1the right version to use here or is there a way to use1.2.70that would work with Java 7? Will I be missing a lot of stuff for using it?I want to understand the 3 kotlin stuff I had to setup on the script. Correct me please:
kotlin-gradle-plugin: Is used to define which version of Kotlin I will be using(?)apply plugin: 'kotlin': As far as I know from Gradle, this should add tasks to work with Kotlin but runninggradle tasksI didn't see anything different... So what is it really for?kotlin-stdlib-jdk7: I'm guessing this is Kotlin lib of functions, classes, etc. What I don't understand though is the difference betweenstdlibandstdlib-jdk7. The documentation says it contains "addition extension functions". But which ones? Also, should I define a version for this guy? Or does it automatically picks up thekotlin-gradle-pluginversion?
Thanks in advance,