Hi,
I have a multi project setup to build a war file, so on project is to build the war file, some projects are java projects and some should only build zip files.
In the java projects I use the java or java library plugin, and when I depend on thise projects in the war project, vereything is fine.
Starting the war task build all java projects and puts the outputs into the war file.
But in the zip file projects, I’m a little lost. It is possible to also use the java plugin to create jars containing the files I need.
And then in the war project I define a new configuration to add dependencies to the zip file projects and do a little more logic to add those projects to the war file:
war {
dependsOn {configurations.resource}
from {
configurations.resource.collect { zipTree(it) }
} {into "WEB-INF/resource"}
enabled = true
}
But I don’t want to use the java plugin.
So I tried to only use the base plugins.
I added the new configuration, added a new task for creating the zip, connected the new configuration with the new task and expanded the assemble-task.
But now when starting the war task, the zip files are neither build nor added to the war file.
So what am I missing?
This is my complete build file for a zip file (with maven publish)
apply plugin: "base"
configurations {
resource.extendsFrom(archives)
}
task buildZip(type: Zip) {
from "resources"
includeEmptyDirs = true
into "resource"
}
artifacts {
compile buildZip
}
assemble.dependsOn buildResource
check.dependsOn buildResource
publishing {
publications {
maven(MavenPublication) {
artifact source: buildZip, extension: 'zip'
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.resource.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
Also the dependencies in the zip file projects are not resolved.