apache / apache/maven-assembly-plugin

[MASSEMBLY-645] File name of dependency depends on how it is reachable

Open
#806 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
110
Forks
75
Avg merge
12h 54m
Merged PRs (30d)
10

Description

**[Tuure Laurinolli](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=tazle)** opened **[MASSEMBLY-645](https://issues.apache.org/jira/browse/MASSEMBLY-645?redirect=false)** and commented

Please see demonstration at https://github.com/tazle/maven-issue-demo

After mvn package, the resulting maven-issue-demo-1.0.0-SNAPSHOT-bin.zip contains the following libraries:

maven-issue-demo-1.0.0-SNAPSHOT/lib/httpcore-4.3-alpha2-SNAPSHOT.jar
maven-issue-demo-1.0.0-SNAPSHOT/lib/httpclient-4.3-alpha2-20130227.160252-28.jar

For some reason httpcore has a -SNAPSHOT version whereas httpclient has a unique version. This is clearly not desirable, since e.g. the classpath generator in JAR plugin generates either -SNAPSHOT names or unique names but not both.

Some analysis:
Originally versions of both libraries are unique. During resolution, some are changed to -SNAPSHOT versions instead. This appears to affect packages that are both direct and transitive dependencies.

Some debug output from a modified assembly plugin, with additional debug output:

[DEBUG] Artifacts before resolution:
[DEBUG] artifact: org.apache.httpcomponents:httpcore:jar:4.3-alpha2-SNAPSHOT, version: 4.3-alpha2-20130220.230238-15, base version: 4.3-alpha2-SNAPSHOT, resolved: true, scope: compile
[DEBUG] artifact: org.apache.httpcomponents:httpclient:jar:4.3-alpha2-SNAPSHOT, version: 4.3-alpha2-20130227.160252-28, base version: 4.3-alpha2-SNAPSHOT, resolved: true, scope: compile
[DEBUG] Resolving project dependencies transitively.
[DEBUG] maven-issue-demo:maven-issue-demo:jar:1.0.0-SNAPSHOT (selected for null)
[DEBUG] org.apache.httpcomponents:httpcore:jar:4.3-alpha2-SNAPSHOT:compile (selected for compile)
[DEBUG] org.apache.httpcomponents:httpclient:jar:4.3-alpha2-SNAPSHOT:compile (selected for compile)
[DEBUG] org.apache.httpcomponents:httpcore:jar:4.3-alpha1:compile (removed - nearer found: 4.3-alpha2-SNAPSHOT)
[DEBUG] commons-logging:commons-logging:jar:1.1.1:compile (selected for compile)
[DEBUG] commons-codec:commons-codec:jar:1.6:compile (selected for compile)
[DEBUG] While resolving dependencies of maven-issue-demo:maven-issue-demo:jar:1.0.0-SNAPSHOT:
[DEBUG] Statistics for Scope filter [null-scope=true, compile=true, runtime=true, test=false, provided=false, system=false]

[DEBUG] The following scope filters were not used:
o Runtime
o Test
o Provided
o System
[DEBUG] resolved artifact: org.apache.httpcomponents:httpcore:jar:4.3-alpha2-SNAPSHOT, version: 4.3-alpha2-SNAPSHOT, baseVersion: 4.3-alpha2-SNAPSHOT
[DEBUG] resolved artifact: org.apache.httpcomponents:httpclient:jar:4.3-alpha2-SNAPSHOT, version: 4.3-alpha2-20130227.160252-28, baseVersion: 4.3-alpha2-SNAPSHOT
[DEBUG] resolved artifact: commons-logging:commons-logging:jar:1.1.1, version: 1.1.1, baseVersion: 1.1.1
[DEBUG] resolved artifact: commons-codec:commons-codec:jar:1.6, version: 1.6, baseVersion: 1.6

---

**Affects:** 2.4

**Issue Links:**
- [MASSEMBLY-714](https://issues.apache.org/jira/browse/MASSEMBLY-714) Update version of plexus-archiver to 2.7.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the demonstration project at https://github.com/tazle/maven-issue-demo and run mvn package to reproduce the differing dependency filenames in the generated ZIP. Read the assembly plugin's dependency-resolution path and compare the debug output for direct and transitive dependencies; done means the archive uses consistent filenames for both dependencies.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.