I struggled with with the jar MANIFEST file built with Gradle containing an empty Class-Path. I traced down the problem to the order of the dependencies and jar blocks in the build.gradle file:
Wrong (jar before dependencies):
jar {
manifest.attributes(
// Class-Path won't contain "guava-15.0.jar"
'Class-Path': configurations.runtime.files.collect { it.name }.join(' ')
)
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.google.guava', name: 'guava', version: '15.0'
}Correct (jar after dependencies):
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.google.guava', name: 'guava', version: '15.0'
}
jar {
manifest.attributes(
// results in "Class-Path: guava-15.0.jar"
'Class-Path': configurations.runtime.files.collect { it.name }.join(' ')
)
}
Thanks a lot for sharing this, I spent many hours on this problem