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
Assignees
Labels
type: bug A general bug
Milestone

Comments

@edudar
Copy link

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 10, 2021
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 10, 2021
@wilkinsona wilkinsona modified the milestones: 2.3.x, 2.4.x Feb 10, 2021
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed type: bug A general bug labels Feb 10, 2021
@wilkinsona
Copy link
Member

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

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.

@wilkinsona wilkinsona added type: bug A general bug and removed type: regression A regression from a previous release labels Feb 10, 2021
@wilkinsona wilkinsona self-assigned this Feb 10, 2021
@wilkinsona wilkinsona modified the milestones: 2.4.x, 2.4.3 Feb 10, 2021
@edudar
Copy link
Author

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
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants