Home > Blockchain >  Tasks with type gradle Kotlin script convert from Groovy (shadow plugin)
Tasks with type gradle Kotlin script convert from Groovy (shadow plugin)

Time:02-01

I tried to convert the Groovy script from shadow plugin's guide

task relocateShadowJar(type: ConfigureShadowRelocation) {
    target = tasks.shadowJar
}
tasks.shadowJar.dependsOn tasks.relocateShadowJar

with something like

tasks.register("relocateShadowJar") {
    com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation(tasks.shadowJar)
}

But it says "too many argument" at tasks.shadowJar. I assumed it needs to be initialized or something like that? How do I convert this? please help me, thank you in advance

CodePudding user response:

Finally, found what I want

task<ConfigureShadowRelocation>("relocateShadowJar") {
    target = tasks.shadowJar.get()
}

tasks.shadowJar.get().dependsOn(tasks.getByName("relocateShadowJar"))
  •  Tags:  
  • Related