How to build library with sub projects

Hi. I have a java project with such structure


rootlib has a dependency on project(':javalib1') and javalib1 has a dependency on project(':javalib2').

I want to build rootlib (jar) and upload it to artifactory. But when I build artifact it doesn’t consist of class files from javalib1 and javalib2.

Could somebody advice me how to add them to the artifact?

I made a sample project if there is a need in it