Need WebJars Unpacking Example

Hello, I’m new to Gradle. Can someone show me how to download a WebJar and unpack it into a target directory?

Something like:

configurations {
   myConfig { transitive = false } 
} 

dependencies {
   myConfig "org.webjars:foo:1.0" 
} 

task unzip(type:Copy) {
   from zipTree(configurations.myConfig.singleFile)
   into "target/unzip" 
} 
1 Like

Thanks Lance! If myconfig has multiple deps, try chaning the unzip task to this. Also, I’d use Sync instead of Copy, to make sure that old versions don’t leave cruft in your unzipped directory.

task unzipWebjars(type: Sync) {
	configurations.myConfig.files.each { jar ->
		from zipTree(jar)
	}
	into 'build/webjar'
}