Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle plugin does not include transitive project dependencies into application layer #25163

Closed
edudar opened this issue Feb 10, 2021 · 3 comments
Closed
Assignees
Milestone

Comments

@edudar
Copy link

@edudar edudar commented Feb 10, 2021

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.

@wilkinsona
Copy link
Member

@wilkinsona wilkinsona commented Feb 10, 2021

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.

@wilkinsona
Copy link
Member

@wilkinsona wilkinsona commented Feb 10, 2021

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.

@edudar
Copy link
Author

@edudar edudar commented Feb 10, 2021

Thanks for such a quick turnaround on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants