正如標題所示,我想知道如何修改gradle.build.kts
以便創建一個具有所有依賴項(包括kotlin lib)的獨特jar
的任務。如何使用gradle kotlin腳本創建胖罐
我發現這個樣品在Groovy:
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'com.mkyong.DateUtils'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
但我不知道我怎麼會寫在科特林,除了:
task("fatJar") {
}
不工作,在第一行'進口com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar','ShadowJar'是懸而未決.. – elect
你試過我的回答以來?我有它測試和工作。我認爲最初的問題是()需要擴展類。 – mbStavola
我再次嘗試了[現在](http://imgur.com/qUozPd2),在'tasks'上面寫着'[DELEGATE_SPECIAL_FUNCTION_MISSING]'TaskValue(Build_gradle,KProperty <*>)''類型爲'TaskContainer! '' – elect