我想爲所有子項目(大約30)定義一個jar任務。我嘗試了以下任務:在gradle中爲jar清單定義自定義類路徑
jar {
destinationDir = file('../../../../_temp/core/modules')
archiveName = baseName + '.' + extension
metaInf {
from 'ejbModule/META-INF/' exclude 'MANIFEST.MF'
}
def manifestClasspath = configurations.runtime.collect { it.getName() }.join(',')
manifest {
attributes("Manifest-Version" : "1.0",
"Created-By" : vendor,
"Specification-Title" : appName,
"Specification-Version" : version,
"Specification-Vendor" : vendor,
"Implementation-Title" : appName,
"Implementation-Version" : version,
"Implementation-Vendor" : vendor,
"Main-Class" : "com.dcx.epep.Start",
"Class-Path" : manifestClasspath
)
}
}
我的問題是,該子項目之間的依賴關係不包括在清單的類路徑。我嘗試將運行時配置更改爲編譯配置,但會導致以下錯誤。
- 出了什麼問題:發生了評估項目 ':EskoordClient'。
您無法更改未處於未解決狀態的配置!
這是項目EskoordClient我的完整構建文件:
dependencies {
compile project(':ePEPClient')
}
我的大部分子項目的建設文件只定義了項目的依賴。第三方lib依賴關係在超級項目的構建文件中定義。
是否有可能將所有需要的類路徑條目(第三方庫和其他項目)包含到所有子項目的超級項目中的清單類路徑中。
你聲明的每子項目,它的任務? (我沒有看到一個'subprojects {}'塊。)出現「無法更改配置」錯誤,因爲您在做這項工作的時間太早(配置階段而不是執行階段)。項目依賴關係對我來說是正確的。你正在使用哪個Gradle版本? – 2012-07-13 13:05:45
我正在使用gradle版本1.0 目前,我在配置'操作中配置了jar目標:configure(subprojects.findAll {it.name.endsWith('Service')|| it.name.endsWith('Common')) || it.name.endsWith('Client')})' – user1490402 2012-07-16 10:49:58