Shade in spring-boot-starter-parent is misconfigured
See original GitHub issueWhen trying to use the default Shade plugin configuration with Maven that is inherited form spring-boot-starter-parent, I get the following error from Maven:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project spring-boot-example:
Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:2.1:shade for parameter transformers:
Cannot load implementation hint 'org.springframework.maven.packaging.PropertiesMergingResourceTransformer'
-> [Help 1]
My POM in this case looks like:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
</plugins>
</build>
I think the package name of PropertiesMergingResourceTransformer should be org.springframework.boot.maven.PropertiesMergingResourceTransformer
I’ve tried the following POM and it generated a proper shaded jar and is working correctly:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
<resource>META-INF/spring.factories</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.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${start-class}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Issue Analytics
- State:
- Created 10 years ago
- Reactions:19
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Shade in spring-boot-starter-parent is misconfigur
The Spring resource transformer class name changed (at least once) since the parent was originally created.
Read more >Maven shade plugin fails on updating Spring Boot version to ...
For a module in my project I use maven-shade-plugin with a simple shade goal, no configuration. When I was using Spring Boot 2.3.3...
Read more >Shade in spring-boot-starter-parent is misconfigur_paraller_15的 ...
Shade in spring -boot-starter-parent is misconfigur. ... 启动springBoot服务报错The port may already be in use or the connector may be misconfigured.
Read more >Spring Boot Reference Documentation
inherits from the spring-boot-starter-parent project and declares dependencies to ... Sensible plugin configuration (exec plugin, Git commit ID, and shade).
Read more >org.springframework.boot : spring-boot-starter-parent : 2.7.2
spring -boot-starter-parent - Parent pom providing dependency and plugin management for applications built with Maven.
Read more >
Top Related Medium Post
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I succeeded in building the project using your method.but the generated jar package failed to run and there was a ‘java.lang.ClassNotFounfException’ error.
Thanks for the analysis.