Plugin to dynamically build another dependent project

I have a plugin that fetches a dependent project (call it Base) from github.
I want my plugin to also build my project (call it MyService) and make it depend on the Base project I just fetched, so the total build will build my project based on the one just fetched from github.

I saw some solutions that dynamically add dependencies but did not work for me and it seems a chicken and egg problem.

Is this possible?

Note: the normal best practice for such scenario would simply be to use artifactory and just point my project to an artifact of the common-infra project. but we do not want to in this case. we need the sources fetched / updated each time we perform a build.