I have issues with copying specific files from a zip/jar file. Have attached a simplified example.
The following build.gradle fails with: Execution failed for task ‘:testUnzip’. > Neither path nor baseDir may be null or empty string. path=‘null’ basedir=‘C:\dev\workspace_dev\test-gradle’
This works in 1.7 but fails in 1.8 and 1.9. Have tried to figure out if anything has changed in the apis. Are there any other way of copy specific files from a zip/jar file?
apply plugin: 'java'
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
task testUnzip(dependsOn: sourcesJar) << {
File dir = project.mkdir(project.buildDir.absolutePath + '/src-unzip')
project.delete(project.fileTree(dir: dir, include: '**/*'))
project.copy {from project.zipTree(tasks.sourcesJar.archivePath) into dir include '**/*.java'}
}