Dynamic dependencies management : jar vs subproject


I have some constraints that I would like to solve by a dependency resolution logic like following :

  • search for a jar ( local / artifactory / …)
  • if not found declare the dependency as a subproject in order to produce it when the top level project will be produced.

Is there something like this already exists ?

I hope that I’m clear.

With many thanks for your help.