Multi-project builds with empty levels

You are probably applying the relevant plugins e.g. the Java plugin to
all subprojects in the top-level root project. Try to be more selective
by filtering the set of projects you are using for configuration
injection.

Ok. I’m not really sure how to do that. I put my generic build file off to the side, like so:

gradle/
–build.gradle { subprojects { apply plugin: ‘java’ … all the main build logic … } }
trunk/
–build.gradle { apply from: “…/gradle/build.gradle” }

It is true that the root project does everything in subprojects { … }, which includes the group layer, unfortunately, But I’m trying to avoid putting boilerplate at the group level, and I also want to be able to do a global build of everything from the top level.

You might want to think about breaking out the projects by groups into separate VCS repositories. Alternatively, just run the build from the directory-level of the group or directory reference the group project when executing the Gradle command e.g. gradle :group1:build. Then you don’t execute all tasks for all subprojects.

I’d rather not use separate repos because that is really inconvenient in my environment. What I was hoping is that I could run builds at the individual project level, the group level, or the root level, and the appropriate scope of projects would get rebuilt. I should also mention that the projects all inter-depend across groups.

If you could give me a hint on how to do the filtering, I think that is what I prefer. Thanks.

1 Like