Java-library-distribution distTar not bundling subproject dependencies

Using distTar (or distZip) from java-library-distribution plugin in a multiproject setup (flat) is not bundling the subproject dependencies. When I unpack the generated archive, only the root dependencies appear in the lib directory. Are there an additional filters or ‘from’ definitions required with the distribution definition?

You likely need to add the dependencies to your ‘zip’ task configuration. There are some solutions for this if you search for ‘gradle fatjar’

As a solution, I removed the plugin and added the following task to subprojects{}:

task bundleTar(type: Tar) {
  from jar.outputs.files
         from (configurations.compile){
      into('lib')
     }
 }

Unless I’m doing something incorrect, I would put this as a bug. After all, isn’t one purpose of a root project is to carry common while the subject carries the unique.

As far as I know Gradle does not treat the hierarchy of your projects in any special way. I think the way you have defined the configuration is correct and not a bug. The only time when Gradle does things implicitly is when you use the builtin plugin tasks.