Gradle Multiproject with SCM

I am migrating to Gradle as my build tool for a Java project. My main project (A) has a dependency on other projects (B and C).

At the moment each of these projects are in CVS individually and when I want to compile A I have to check out A, make a subdir in A called B in which I check out B. Same goes for C.

Im going to migrate to repository manager (nexus) in which B and C can be published to. When this happens, module A can just have a dependency on B and C which it can get from nexus.

However, the difficulty arises if I do not want to publish B and C (for testing purposes) and I want to build A with my latest code from B and C without committing it to nexus.

My initial thoughts on this are to build the jar for B and C and pull it into the “lib” folder for A. However Im sure there is a better way.

In maven I could do a “mvn clean install” which would install B and C in my local maven cache. A would then look there for the appropriate jars.

But Im still not sure this is the best way. I had a look into gradle subprojects but I dont fully understand them. How would the submodules handle in an SCM (would I also need to use git submodules?)

I would appreciate some guidance as to best practices for this situation. Thanks

This will be conveniently solved by composite builds in Gradle 3.1.

Until then you can apply the maven plugin and use the install task to install the local version of B into your local repository.

Thanks for the info. I am very excited about 3.1 now.

Would it also be able to have a repo A in which there is a with a “compile project” dependancy. You would have to manually checkout the dependency into a subdir of A though.
Would this work? Are there any advantages/disadvantages to this method?

Thanks again. Your help is very much appreciated.

Yes, you have to manually check out the project (or automate that somehow, for instance using myrepos). Gradle might provide deeper SCM integration in the future to make that even easier, but it is not on our short-term priority list.

You’ll be able to programatically define composites, so you could for instance dynamically react to other folders being there.