-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin DSL support #317
Comments
try this
|
That succeeded without any errors, but it doesn't seem to be picking up my main class: |
Additionally, the shadow jar seems to be empty. I changed your suggestion to this so I could separate the jars:
But here's the result:
|
Any update on this? |
@crummy you didn't actually apply the shadow plugin in your example build file. You've added teh jar to the classpath, but you haven't applied the plugin. The example that @thiagogcm gives doesn't work because it's just creating a standalone |
Perhaps there's a preliminary step before:
as here: |
Since I originally came to this issue page looking for a solution for customizing ShadowJar tasks in Kotlin, I'd better leave the answer I came up with: 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"
application
}
group = "io.mikael"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("io.pebbletemplates:pebble:3.0.0")
implementation("com.atlassian.commonmark:commonmark:0.11.0")
implementation("org.yaml:snakeyaml:1.21")
implementation("org.slf4j:slf4j-nop:1.7.25")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
application {
mainClassName = "io.mikael.static.AppKt"
}
tasks.withType<ShadowJar> {
baseName = "app"
classifier = ""
version = ""
} |
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
tasks {
named<ShadowJar>("shadowJar") {
archiveBaseName.set("app")
mergeServiceFiles()
manifest {
attributes(mapOf("Main-Class" to "com.app.App"))
}
}
} |
Shadow Version
2.0.0
Gradle Version
4.1
Expected Behavior
I should be able to run
./gradlew shadowJar
with abuild.gradle.kts
fileActual Behavior
Task 'shadowJar' not found in root project 'hello-world'.
Gradle Build Script(s)
The text was updated successfully, but these errors were encountered: