groovy Gradle -自定义清单中的类路径

xtupzzrd  于 2022-11-01  发布在  其他
关注(0)|答案(1)|浏览(184)

我想创建一个比从我的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(' ')
pokxtpni

pokxtpni1#

你能不能试试:

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

相关问题