Skip to content

Instantly share code, notes, and snippets.

@lifuzu
Created December 12, 2013 05:37
Show Gist options
  • Save lifuzu/7923644 to your computer and use it in GitHub Desktop.
Save lifuzu/7923644 to your computer and use it in GitHub Desktop.
extract the class file to create a jar package
//1. Use the zipTree directly in the jar task rather than creating an intermediate zip.
//2. Use eachFile to change the relative path of each file to strip off the first folder.
jar {
from zipTree('runtime.jar') {
include 'classes/**/*.class'
eachFile { it.relativePath = it.relativePath.segments[1..-1] }
}
}
//Jar tasks have all of the CopySpec methods, which provide the eachFile abilities.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment