Hi,
I see there are multiple discussions on this topic in the forum. But none of the solutions worked for me. Hence posting this.
I have a project structure like this:
rootProject
– subProject
- childProject1
- childProject2
- childProject3
settings.gradle at root project has this:
rootProject.name = 'cssTheme'
// alphabetical order
include \
'allcss:project1',
'allcss:project2',
'allcss:project3'
my top level build.gradle has this:
evaluationDependsOnChildren();
def publishGroup = project.baseGroup
evaluationDependsOnChildren();
def cssTheme = file("./allcss/css_files.zip")
project.configurePublishingPublications project, {
publishCustomTheme(MavenPublication) {
groupId publishGroup
setArtifactId 'cssTheme'
artifact cssTheme
}
}
task themesZipFileTask(type:Zip) {
dependsOn subprojects*.build
from('./allcss/project1/project1.css')
from('./allcss/project2/project2.css')
from('./allcss/project3/project3.css')
from ('./common/common.css')
destinationDir(file('./allcss'))
archiveName ("css_files.zip")
}
build.finalizedBy tasks.themesZipFileTask
project.configureArtifactoryPublications project,
'publishCustomTheme'
I am using gradle 1.12.
I have following questions:
-
Is it possible to create a zip file with all the subprojects built artifacts at the root project level? I see that the zip task is called only at config phase, not at execution. Is this expected behavior?
-
if (1) is not possible, what is the best way to aggregate all the subprojects artifacts into one file?
-
If (1) is possible, then, what am I missing in the code? I have noticed that only “common.css” (Which is a static file) goes into the zip. None of the other css files are there.