I have one subproject that pulls together files from other subprojects for distribution. An artifact of one of those other subprojects is a ZIP file. I’m having trouble making both of these happen at the same time:
- Force the creation of the other subproject’s ZIP file if it hasn’t already been created * Explode the contents of that other ZIP file into my local project
And I’m hoping someone can see what I’m doing wrong.
Other Subproject:
defaultTasks 'distZip'
task distZip(type:Zip) {
// ...
}
configurations {
archive
}
artifacts {
archive distZip
}
Local Project:
configurations {
archive
}
dependencies {
// Dep A:
//archive
project(path: ':tools:importer', configuration:'archive')
// Dep B:
archive
project(path: ':tools:importer')
}
task installServer(type: Copy) {
// ...
// Dep A: Builds tool ZIP, but just copies in unexploded version
// Dep B: Builds tool JAR, puts its dependencies in 'tools', but nothing else
//into("tools") {
//
from(project.configurations.archive)
//}
// Dep A: Does not trigger dependency. If ZIP exists, explodes into root, not tools.
// Dep B: Does not trigger dependency. If ZIP exists, does not use it. ***
into("tools") {
project.configurations.archive.each{
from zipTree(it)
}
}
}
*** It looks like this combination explodes each of the dependent JARs, which I really don’t understand.
One more odd thing that I’ll mention in case it matters is that in the “Other” project I had to place the ‘configurations’ and ‘artifacts’ sections after the distZip task. Otherwise building the distZip task in that project gave me the message:
A problem occurred evaluating project ':tools:importer'.
> No such property: distZip for class: org.gradle.api.internal.artifacts.dsl.DefaultArtifactHandler
Version info:
------------------------------------------------------------ Gradle 2.1 ------------------------------------------------------------
Build time:
2014-09-08 10:40:39 UTC Build number: none Revision:
e6cf70745ac11fa943e19294d19a2c527a669a53
Groovy:
2.3.6 Ant:
Apache Ant™ version 1.9.3 compiled on December 23 2013 JVM:
1.7.0_21 (Oracle Corporation 23.21-b01) OS:
Mac OS X 10.8.5 x86_64