1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
repositories { ivy { url 'https://repository.example.com/' patternLayout { // adapt as needed: artifact '/foo/[organisation]/bar/[module]/[revision]/[module]-[revision].[ext]' } // Required in Gradle 6.0+ as metadata file (ivy.xml) is mandatory: metadataSources { artifact() } } } configurations { zipped } dependencies { // "crusy" maps to "organisation", "MyZipFile" to "module", // "1.3" to "revision", "zip" to "ext" in above patternLayout: zipped 'crusy:MyZipFile:1.3@zip' } tasks.register('unzip', Copy) { dependsOn configurations.zipped from { configurations.zipped.collect { zipTree(it) } } into "${buildDir}/dependencies" include '**/*.jar' // or whatever you want/don't want } build.dependsOn tasks.unzip |
Darauf zugreifen kann man dann bspw. in anderen Tasks mittels
1 |
files("${buildDir}/dependencies/SomeFancyJar.jar") |
PS: Mir ist bewusst, dass ${buildDir}
deprecated ist, aber ${layout.buildDirectory}
ging aus irgendeinem Grund nicht.