簡體   English   中英

Gradle - 在清單中自定義類路徑

[英]Gradle - Customize Classpath in Manifest

我想創建一個更通用的類路徑,而不是從我的 build.gradle 文件的這個片段生成的:

jar {
manifest {
    attributes (
        "Main-Class": "x.y.z.main",
        "Specification-Title" : "Oh how specific!",
        "Specification-Vendor" : "Super Secret",
        "Specification-Version" : "1.0", 
        "Implementation-Title" : "Top Notch Software",
        "Implementation-Version" : "1.0 Build Nr. 1",
        "Implementation-Vendor" : "Super Secret",
        "Implementation-Vendor-Id" : "x.y.z.com",
        "Implementation-Url" : "http://www.x.y.z.com",
        "Class-Path": configurations.runtimeClasspath.files.collect { it.absolutePath }.join(' ')
    )
}

這會產生這樣的結果:

...Class-Path: C:\Users\YouWouldLikeToKnow\.gradle\caches\modules-2\files-2.1\org.springframework.cloud\spring-cloud-starter-gateway\3.1.3\d008ce51415d0507a1806bd0a518a21860ee0f63\spring-cloud-starter-gateway-3.1.3.jar...

相反,我想將其配置為:

...Class-Path: libs\external\spring-cloud-starter-gateway-3.1.3.jar...

就像是:

configurations.runtimeClasspath.files.collect {"libs\external\" + it.fileName}.join(' ')

你能試試:

'Class-Path': configurations.runtime.files.collect{ "lib/external/" + it.getName() }.join(' ')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM