Wondering about Jenkins Pipeline and Composite Builds

When composite builds first came out, we immediately embraced them. It removed a lot of complexity that we were engineering in the CI/CD layer and put most of the logic in Gradle, where we wanted it. What we really simplified was artifact handling… we just didn’t do it. Every time we run Gradle, we pass the --include-build option, and Gradle’s incremental build option ensures we only build things when we need to.

We are now re-engineering things to work in Jenkins Pipelines, and at the same time, trying to parallelize and improve efficiency. The drawback to composite builds is that we need source checked out on every node… which seems contrary to the way the Jenkins team think about pipelines. If I drop the --include-build option in downstream Gradle executions, it starts pulling artifacts down from Maven and “forgets” the source code dependencies.

I suppose I can “stash” and “unstash” the artifacts I built with the --include-build option, but I don’t know how to make Gradle recognize those artifacts downstream.

Have I missed something very simple here? Are others struggling with this as well?

2 Likes