I am using gradle v3.4 and shadowjar v1.2.4. I added the following task but I get an error copied below when doing this. I added a task of type ShadowJar in order to be able to generate different jar files from the same project.
Shadowjar works fine for me outside the context of this task.
gradle
task someJar(type: ShadowJar) {
group = "shadow"
description = "some executable jar"
mainClassName = 'com.some.client.SomeClient'
main = 'com.some.client.SomeClient'
manifest.attributes 'Main-Class': 'com.some.client.SomeClient'
classifier = 'someClient'
from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)
configurations = [project.configurations.runtime]
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
}
error using stacktrace
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'ShadowJar' for root project 'someporject' of type org.gradle.api.Project.
at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:85)
at org.gradle.groovy.scripts.BasicScript.getProperty(BasicScript.java:81)
at build_2cp7m6fw08pxyu0f84a6pva88.run(/Users/continue/git/iso20022/build.gradle:202)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
Specifying the type as com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar instead of ShadowJar resolved the issue for me.
task someJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
this would also work:
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
task someJar(type: ShadowJar) {
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With