apache / apache/maven-assembly-plugin

[MASSEMBLY-869] Spurious dependency when profile is disabled

Open
#1,078 0 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

**[Olivier Cailloux](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=oliviercailloux)** opened **[MASSEMBLY-869](https://issues.apache.org/jira/browse/MASSEMBLY-869?redirect=false)** and commented

My assembly descriptor contains a dependency set entry, that supposedly should include all dependencies for my project and nothing more, namely, only one dependency in my case. But two dependencies get included.

My project uses profiles. The profile configures a “bcprov” property, which determines the (sole) dependency of my project. Under the “swt-unix” profile, this should be org.bouncycastle:bcprov-jdk15on:1.57, while under the “swt-windows” profile, this should be org.bouncycastle:bcprov-jdk14:1.57.

But running `mvn -P '!swt-unix,swt-windows' package` includes **both** org.bouncycastle:bcprov-jdk15on:1.57 and org.bouncycastle:bcprov-jdk14:1.57 in the “test-dep-0.0.1-SNAPSHOT-runnable-windows.zip” artifact produced by the assembly.

The problem seems related to the “swt-unix” profile activation section.

Please see [GitHub](https://github.com/oliviercailloux/test-dep) and [Travis](https://travis-ci.org/oliviercailloux/test-dep) to see the issue at work with some debug information (the dependency plugin shows that the correct dependencies seem to have been computed, and the manifest includes the correct classpath entry, yet the dependencies included in the artifact are incorrect).

---

**Affects:** 3.1.0

**Attachments:**
- [pom.xml](https://issues.apache.org/jira/secure/attachment/12882309/pom.xml) (_2.05 kB_)
- [Runnable.xml](https://issues.apache.org/jira/secure/attachment/12882308/Runnable.xml) (_698 bytes_)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the attached pom.xml and Runnable.xml, then reproduce the issue with `mvn -P '!swt-unix,swt-windows' package` or the linked test-dep project. Compare the dependencies reported by the dependency plugin with those included in the generated Windows ZIP, and use the Travis debug information to trace the profile activation behavior. Done means the artifact contains only the dependency selected by the active profile.

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
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.