I have a complex Maven project structure that has many defined dependencies in it. Also dependencies used in the project are not just external but also internal and I am working on them. All of them are repositories stored on Gitlab. There is defined dependency graph that looks like a tree.
Example
Here is a simple example of how dependencies are defined:
/--> C
A ---> B - /--> D
\--> D -
\--> E
In this example it can be seen that Maven project A
has dependency on project B
. Also project B
has included dependencies C
and D
inside it. Project D
includes dependencies on projects D
and E
.
We can now split this tree in layers numbered from 0 to 3:
3 | 2 | 1 | 0
____________________________
| | /--> C |
A |---> B |- | /--> D
| | \--> D |-
| | | \--> E
After every commit/merge into develop
branch for all projects, pipeline for build and deployment will automatically run.
The tree is much more complex, but for example this is enough good.
PROBLEM
If I commit some changes into project E
, I have to merge my feature branch into develop
branch so the automatic build and deployment of JAR file will be done, but now the boring part starts... I have to do the same for every Maven project starting from E
to the left side in above graph and the only change there is the new version of the E
project in their POM files. I also have to deploy new SNAPSHOT versions for all projects from right layers to left, but also in every layer I have to deploy projects from top to bottom. For example, I will have to first deploy project C
and then D
inside layer number 1.
Deployment order would look like this:
E, C, D, B, and then finally A.
What I want to achieve?
After I commit my changes into project E
, I would like that in the order defined above all the projects starting from E
to the left side:
- Use new version of the project
E
in their POM files - Change their version to one higher
- Run the build and deploy script
What I do now?
Currently I am using a single runner (to be sure that I will deploy only one repository at the time) for all projects above and I am doing this manually. I am manually replacing new version of the project in all POM files in all projects and doing it in the order described above. I am also waiting for pipeline to finish and when I see that it is done, I am doing then manually same thing for next project, until I don't finish the project A
.
Is there any way to automate this? I need some solution for automatic SNAPSHOT version update for example, then some autimated way of deploying all the projects from right to left (maybe to use multi-project pipelines?).