Hi,
you need to create a parent project which would have project A and Project B
consider Project A and B as another module and the Project itself would consist another modules.
You can common dependencies to parent project as well but it is optional.
Arun Patidar