Multi-project automatically trigger builds of dependent sub projects

Hello Gradle community :wave:
I am new in gradle and need to find approach for my “problem”.

In my repo, i am using multi-project architecture. ProjectA, ProjectB and ProjectC.
ProjectB depends on ProjectA. Here is part of build.gradle.kts file of ProjectB

dependencies {
    implementation(project(":ProjectA"))

This is working fine. If i run build from ProjectB it will include projectA.

The story is, if i make some changes in ProjectA how can i automatically trigger build and release of ProjectB too? If something change in ProjectA that’s mean that i also need to release new version of ProjectB becuase it’s depend on ProjectA.

How should i solve this? On CI level or in gradle?

Just to note, for CI i am using github action and matrix strategy. If i make some changes in ProjectA it will build, release and publish just ProjectA. The same is for ProjectB and ProjectC. If make changes to all projects, it will run build, release and publish in parallel.

Update: My every sub project has it’s own version, and i am running build, release and publish from the sub projects. I don’t want to release new version of sub projects if there is no any change in code.

Thanks a lot.

Hello @lrngradle

if you use java plugin you could use buildDependents Executing Multi-Project Builds

https://docs.gradle.org/current/userguide/java_plugin.html#lifecycle_tasks

hope that help and have a nice day :slight_smile:

1 Like