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.
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.
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.