Answer the question
In order to leave comments, you need to log in
How to set start class in gradle (Kotlin, KotlinDSL, Gradle)?
There is a build.gradle
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
plugins {
java
kotlin("jvm") version "1.3.70-eap-184"
application
}
group = "dev.glo"
version = "1.0-SNAPSHOT"
application {
mainClassName = "dev.glo.Main"
}
repositories {
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
testImplementation(kotlin("test"))
implementation("com.google.guava", "guava", "28.2-jre")
}
sourceSets["main"].withConvention(KotlinSourceSet::class) { kotlin.srcDir("src/main/dev/glo/Main") }
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
}
no main manifest attribute, in D:\IdeaProjects\testGradle\build\libs\testGradle-1.0-SNAPSHOT.jar
Answer the question
In order to leave comments, you need to log in
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
jar {
manifest {
attributes(
mapOf(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version,
"Main-Class" to mainClassNameProject
)
)
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question