We have several git repos in our environment, some are web front, some are service layer, and some are back end. Some of our modules are libraries that are dependencies of other modules and some are not dependencies but contain web services etc.
I need to be able to setup Gradle to optionally link to the source for a module if the developer has that module included in the IntelliJ project. For example, a UI developer doesn't need all of the Java libraries to do their job but another developer might.
It is possible to add the maven plugin for Gradle and do an install on the dependent modules but that is far from ideal. Doing so requires us to manually do an install on each module to put the compiled jar into the .m2 directory so the dependent modules can then use that jar. After every install/refresh you have to go into IntelliJ and re-add the source path for each library as it isn't automatic. This method also doesn't automatically do the install when I rebuild my project either.
I know it is possible as we did it at a company I worked for in the past. I wasn't involved much with the build management so I didn't learn how it was done.