简体   繁体   中英

Gradle - Customize Classpath in Manifest

I want to create a more general Classpath, than what is generated from this snippet of my build.gradle file:

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(' ')
    )
}

This yields something like this:

...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...

Instead i want to configure it to be like so:

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

Something like:

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

你能试试:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM