I have a gradle build with many subprojects. One subproject generates a WAR and needs to include xhtml files from ui-module subprojects that will be included in the WAR. At the moment I search for the ui-modules programatically and copy the files. But I was wondering if I could solve it with a separate configuration.
I want to generate zip files with the xhtml files into the configuration uiModule as artifacts. Later the artifacts should be unzipped into the war. My build.gradle for the ui-modules looks like this
configurations {
uiModule
}
task zipXhtmlFiles(type: Zip) {
from 'xhtmlResources'
}
artifacts {
uiModule zipXhtmlFiles
}
The war should access the xhtmlFiles like this
apply plugin: 'war'
dependencies {
uiModule project('someUiModuleProject')
}
war {
//unzipping will be done later
from configurations.uiModule.allArtifacts
}
However, when I create the war, the zipXhtmlFiles is not executed and when I print the arifacts they don't contain the zip files. Can this be solved without writing an extra task class? Am I getting something wrong?