apache / apache/maven-shade-plugin

[MSHADE-419] Shade plugin causes pom to be created without compile dependencies

Open
#711 4 comments 0 reactions 0 assignees View on GitHub
bug priority:critical
Dominant language
Java
Stars
188
Forks
103
Avg merge
16h 39m
Merged PRs (30d)
4

Description

**[BM](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=brad103)** opened **[MSHADE-419](https://issues.apache.org/jira/browse/MSHADE-419?redirect=false)** and commented

A project using shade-plugin 3.2.4 deploys with a pom containing all the dependencies as defined.

A project using shade-plugin 3.3.0 deploys with a pom containing only the 'test' and 'provided' dependencies. This causes transitive dependency issues for downstream projects.

 

```java

  4.0.0
test
    shade-apr-2022
    jar
    1.0.0-SNAPSHOT   


        2.9.6
       

       

            com.fasterxml.jackson.core
            jackson-core
            ${jackson-version}
               

            com.fasterxml.jackson.core
            jackson-databind
            ${jackson-version}
               

            com.fasterxml.jackson.core
            jackson-annotations
            ${jackson-version}
               

            com.thoughtworks.xstream
            xstream
            1.4.10
               


       
            junit
            junit
            4.11
            test
       
   
   
       
           
                org.apache.maven.plugins
                maven-compiler-plugin
                3.8.0
               
                    11
               
           
           
                org.apache.maven.plugins
                maven-shade-plugin
                3.3.0
               
                   
                        package
                       
                            shade
                       
                       
                            true
                           
                               
                                    META-INF/spring.handlers
                               
                               
                                    META-INF/spring.factories
                               
                               
                                    META-INF/spring.schemas
                               
                               
                           
                       
                   
               
           
       
   

```

Dependencies in deployed pom with shade-plugin 3.2.4:

```java


com.fasterxml.jackson.core
jackson-core
${jackson-version}


com.fasterxml.jackson.core
jackson-databind
${jackson-version}


com.fasterxml.jackson.core
jackson-annotations
${jackson-version}


com.thoughtworks.xstream
xstream
1.4.10



junit
junit
4.11
test


```

Dependencies in deployed pom with shade-plugin 3.3.0:

```java


junit
junit
4.11
test


hamcrest-core
org.hamcrest




```

Note also an exclusion on hamcrest-core. I don't know where that is coming from.

It looks to be related to the `dependency-reduced-pom.xml` but the behaviour has changed in this plugin version.

---

**Affects:** 3.3.0

**Remote Links:**
- [GitHub Pull Request #149
](https://github.com/apache/maven-shade-plugin/pull/149)
- [GitHub Pull Request #162
](https://github.com/apache/maven-shade-plugin/pull/162)

5 votes, 10 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the example with maven-shade-plugin 3.3.0 and compare the generated dependency-reduced-pom.xml with the 3.2.4 output shown in the issue. Trace how compile, test, and provided dependencies are written, including the hamcrest-core exclusion. Done means deployed output retains the compile dependencies without the unexpected exclusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.