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

Maven shade plugin configuration in spring-boot-starter-parent does not append META-INF/spring/*.imports files #31316

Closed
FloEberle opened this issue Jun 9, 2022 · 6 comments
Labels
type: bug A general bug
Milestone

Comments

@FloEberle
Copy link

FloEberle commented Jun 9, 2022

Hello everyone

We are using maven shade in latest version 3.3.0 to build our jar. When upgrading from Spring Boot 2.6.8 to 2.7.0 the actuator endpoints seem no longer to work in the shaded jar.
Since I am unsure if this is caused by spring boot or maven shade, therefore I raised the issue there too.

I created a small demo project to visualize the issue. All help is appreciated.

Thanks in advance!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 9, 2022
@philwebb
Copy link
Member

philwebb commented Jun 9, 2022

Thanks for the report. This is due to changes we made to the way that auto-configuration classes are found. You can fix your build by changing the <transformers> section to:

<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
  <resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
  <resource>META-INF/spring.schemas</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
  <resource>META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
  <resource>META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports</resource>
</transformer>

@philwebb
Copy link
Member

philwebb commented Jun 9, 2022

We should update our spring-boot-starter-parent project and also check our documentation.

@philwebb philwebb added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 9, 2022
@philwebb philwebb added this to the 2.7.x milestone Jun 9, 2022
@philwebb philwebb changed the title Shade plugin with latest Spring Boot 2.7.0 breaks actuator endpoints Maven shade plugin configuration in spring-boot-starter-parent does not append META-INF/spring/*.import files Jun 9, 2022
@FloEberle
Copy link
Author

Thanks a lot, that actually resolves the issue! 😎
How can I buy u a coffee/beer @philwebb ? 🙃

@mf81bln
Copy link

mf81bln commented Jun 10, 2022

@philwebb Thanks a lot for the quick response! ❤️

I assume this is the change you're referring to?
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes#changes-to-auto-configuration

If so, perhaps it would be helpful to mention the necessary changes in the release notes? Even though many rely on the spring-boot-starter-parent, I assume that others also encounter the same problem as we did while using spring-boot-dependencies.

@philwebb
Copy link
Member

This has now been fixed. I've also added a new section to the release notes.

@philwebb philwebb modified the milestones: 2.7.x, 2.7.1 Jun 13, 2022
@mf81bln
Copy link

mf81bln commented Jun 14, 2022

@philwebb Thanks a lot! ❤️

@wilkinsona wilkinsona changed the title Maven shade plugin configuration in spring-boot-starter-parent does not append META-INF/spring/*.import files Maven shade plugin configuration in spring-boot-starter-parent does not append META-INF/spring/*.imports files Jun 23, 2022
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

4 participants