I would like my Gradle build script to add the complete Classpath to the manifest file contained in JAR file created after the build.
Example:
Manife
If your project has external library dependencies, you could copy the jars to a folder and add the classpath entries in the manifest.
def dependsDir = "${buildDir}/libs/dependencies/"
task copyDependencies(type: Copy) {
from configurations.compile
into "${dependsDir}"
}
task createJar(dependsOn: copyDependencies, type: Jar) {
manifest {
attributes('Main-Class': 'com.example.gradle.App',
'Class-Path': configurations.compile.collect { 'dependencies/' + it.getName() }.join(' ')
)
}
with jar
}
More details can be read here