I can copy all the jars in dependency section for “compile” configuration like so
task('copyJars') {
ext.collection = files { genLibDir.listFiles() }
delete ext.collection
copy { from configurations.compile into genLibDir }
}
but how do I copy their source jar files somewhere?
thanks,
Dean
As of Gradle 1.0, I don’t know of an easy way to deal with third-party sources Jars. You could add them as explicit dependencies (to a separate configuration) or maybe crawl the Gradle cache.
By the way,
delete ext.collectionis in the wrong spot. It will be executed in the configuration phase, and will delete files no matter which tasks are going to be executed. (AlsolistFiles()will get invoked for every build.)Also, a task whose main purpose is copying should alway use the
Copytask type rather than thecopymethod.