rootProject's make multiproject `gradle install`s fail

plugins

(Andrew Pennebaker) #1

If a multiproject has a rootProject, then gradle install places an empty (classless) JAR in .m2, even though build/libs/myproject-version.jar does have classes.

One workaround involves moving the rootProject to a “…-common” child project, but it would be better for this to work out of the box.

Gradle 2.3.10 with built-in Maven plugin

Mac OS X 10.11.4 El Capitan


(Mark Vieira) #2

This probably means you are applying the ‘maven’ and ‘java’ plugins to the root project, likely in an allprojects { } block. I might suggest moving this to the more appropriate subprojects { } block.


(Andrew Pennebaker) #3

Thanks for the tip!

Does allprojects behave strangely with a rootProject?


(Mark Vieira) #4

allprojects { } does exactly it says, it applies the given configuration to all projects, this includes the root project. Using subprojects { } simply doesn’t include the current project, only it’s descendants.

In this case you’ve applied the ‘java’ and ‘maven’ plugins to a project with no source (the root project), thus explaining why it published an empty JAR.