Using Spring Boot 2.4.2, layers configuration include project dependencies into application layer by default such as

bootJar {
  layered {
    dependencies {
      intoLayer("application") {
        includeProjectDependencies()
      }

This, however, takes only immediate project dependencies into account. When a project has 3+ levels of modules, like

data {
}

common_services {
  dependencies {
    api project(":data")
  }
}

my_app {
  dependencies {
    implementation project(":common_services")
  }
}

layers.idx for my_app will be like

- "dependencies":
  - "BOOT-INF/lib/data-1.0.0.jar"
- "application":
  - "BOOT-INF/lib/common_services-1.0.0.jar"

A workaround is to include both data and common_services as project dependencies in my_app. It'd be good if the plugin would lookup by project hierarchy to include all project dependencies.

Comment From: wilkinsona

Thanks for the report, @edudar. This appears to be a regression in 2.4.x. As far as I can tell, it works in 2.3.x. It would be great if you could try with 2.3.8.RELEASE and let us know if you see the same behaviour. In the meantime, I'll investigate a fix.

Comment From: wilkinsona

Sorry, please ignore the above. I modified multiModuleCustomLayers in BootJarIntegrationTests to reproduce the problem. It's using a include pattern in 2.3.x and includeProjectDependencies() in 2.4.x. It's only the latter that doesn't work with transitive project dependencies.

Comment From: edudar

Thanks for such a quick turnaround on this!