我正在使用gradle v3.4和shadowjar v1.2.4。我添加了以下任務,但在執行此操作時遇到下面的錯誤。我添加了一個ShadowJar類型的任務,以便能夠從同一個項目生成不同的jar文件。無法設置用於gradle任務的類型shadowJar
在這個任務的背景下,Shadowjar對我來說工作得很好。
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')
}
錯誤使用堆棧跟蹤
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)
https://github.com/johnrengelman/shadow/issues/108#issuecomment-62638205 – 030