Last active
October 7, 2020 12:14
-
-
Save vlsi/f676b5ea830b82a64c8eaf3ea6c92a3b to your computer and use it in GitHub Desktop.
Add Class-Path attribute to a jar manifest in Gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add Class-Path to the existing "jar" task | |
tasks.jar { | |
val classpath = configurations.runtimeClasspath | |
// Input declaration is needed for the proper up-to-date checks | |
inputs.files(classpath).withNormalizer(ClasspathNormalizer::class.java) | |
manifest { | |
attributes( | |
"Class-Path" to classpath.map { cp -> cp.joinToString(" ") { it.absolutePath } } | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment