After a bit of a fight, got my build file functional:
`import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
kotlin(“jvm”) version “1.2.51”
id(“com.github.johnrengelman.shadow”) version “2.0.4”
}
group = “xxx.yyy”
version = “1.0-SNAPSHOT”
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin(“stdlib-jdk8”))
}
tasks.withType {
kotlinOptions.jvmTarget = “1.8”
}
tasks.withType {
baseName = "app"
classifier = "inajar"
version = "9"
manifest.attributes.apply {
put("Implementation-Title", "Gradle Jar File Example")
//put("Implementation-Version" version)
put("Main-Class", "HelloKotlinWorld.App")
}
}
`
Now, the question is: what does it mean and how does it work?
In particular, this syntax:
tasks.withType<ShadowJar>
means what? It’s invoking the withType
method of a task
instance? I’m not familiar with the diamond syntax in this context. What does the diamond operator, less than and greater than, do?
I have other questions, but that’s my primary confusion. Obviously, learning this DSL.