apache / apache/maven-shade-plugin

[MSHADE-274] Can't resolve dependency from parent pom which has classifier based on property

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

Description

**[Mikhail Gromov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mgtriffid)** opened **[MSHADE-274](https://issues.apache.org/jira/browse/MSHADE-274?redirect=false)** and commented

**What I do:**
Have a parent pom which has dependency:

```

org.conscrypt
conscrypt-openjdk
1.0.1
${os.detected.classifier}

```

and extension in `` section:

```


kr.motd.maven
os-maven-plugin
1.5.0.Final

```

This extension fills property `${os.detected.classifier}`.
Also this parent pom has Maven Shade plugin configured:

```

org.apache.maven.plugins
maven-shade-plugin
3.1.0

true


*:*

META-INF/*.SF
META-INF/*.DSA
META-INF/*.RSA






package

shade





${shade.main.class}




```

And I have another project which uses described pom as parent pom.
Run `mvn clean install`.
**What I expect:**
Build is successful, Maven Shade plugin finds correct version of Conscrypt jar, in my case it is
`org.conscrypt:conscrypt-openjdk:jar:linux-x86_64:1.0.1`
**What I see instead:**
Build fails. First Maven Shade plugin mentions correct jar with correct classifier when it names all jars, like this:

```
[INFO] Including org.conscrypt:conscrypt-openjdk:jar:linux-x86_64:1.0.1 in the shaded jar.
```

But later build fails with

```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) on project example-service: Error creating shaded jar: Could not resolve following dependencies: [org.conscrypt:conscrypt-openjdk:jar:${os.detected.classifier}:1.0.1 (compile)]: Could not resolve dependencies for project com.example:example-service:jar:2.7.8-SNAPSHOT: Failure to find org.conscrypt:conscrypt-openjdk:jar:${os.detected.classifier}:1.0.1 in ...here goes correct Artifactory URL, omitting for security reasons
```

**Notably:**
When I include my dependency and plugin in this child pom, everything works fine, build succeeds, jar is there.

Is this a bug in Maven Shade plugin, or am I doing something wrong?

---

**Affects:** 3.1.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the parent/child POM setup described in the issue and run `mvn clean install`. Compare dependency resolution when the Maven Shade plugin and dependency are inherited from the parent versus declared in the child. Done means the inherited configuration resolves `${os.detected.classifier}` to the platform classifier and the shaded build succeeds.

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.