Shade in spring-boot-starter-parent is misconfigured

See original GitHub issue

When 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:closed
  • Created 10 years ago
  • Reactions:19
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
tokerrcommented, Aug 12, 2017

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.

2reactions
dsyercommented, Feb 24, 2014

Thanks for the analysis.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found