maven-assembly-plugin icon indicating copy to clipboard operation
maven-assembly-plugin copied to clipboard

MASSEMBLY-919: Fix dependency scope handling

Open gzsombor opened this issue 4 years ago • 2 comments

The problem is that the assembly plugin collects every dependency, flatten the dependency hierarchy tree, and only after this, filter's out by scope. This will cause that if A has a test dependency B, which has a 'runtime' dependency C, C is treated as a runtime dependency of A, and it is included. The implemented fix is using proper tree walking, and checking eagerly the scope of the dependency.

Following this checklist to help us incorporate your contribution quickly and easily:

  • [X] Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.
  • [X] Each commit in the pull request should have a meaningful subject line and body.
  • [X] Format the pull request title like [MASSEMBLY-XXX] - Fixes bug in ApproximateQuantiles, where you replace MASSEMBLY-XXX with the appropriate JIRA issue. Best practice is to use the JIRA issue title in the pull request title and in the first line of the commit message.
  • [X] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • [X] Run mvn clean verify to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.
  • [ ] You have run the integration tests successfully (mvn -Prun-its clean verify).

If your pull request is about ~20 lines of code you don't need to sign an Individual Contributor License Agreement if you are unsure please ask on the developers list.

To make clear that you license your contribution under the Apache License Version 2.0, January 2004 you have to acknowledge this by using the following check-box.

gzsombor avatar Aug 09 '19 20:08 gzsombor

@gzsombor can you please help us draft an integration test first? I tried to replay your described scenario and I do not see any errors. Here is the code https://github.com/struberg/maven-assembly-plugin/tree/MASSEMBLY-919

Where does my IT differ from your use case?

struberg avatar Dec 24 '19 08:12 struberg

I've replaced Easymock with Mockito, so this PR needs to be updated

rfscholte avatar Apr 26 '20 10:04 rfscholte

any update ? this problem is still exists

Geker avatar Jan 11 '23 07:01 Geker

Ideally we need an IT (or some test) that reproduces the issue (fails the expectation) and then a PR that fixes it (makes IT pass).

@Geker can you provide a reproducer? or does https://github.com/apache/maven-assembly-plugin/pull/12#pullrequestreview-336128503 work?

cstamas avatar Jan 11 '23 07:01 cstamas

We should direct use Resolver API. By the way thanks for effort.

slawekjaranowski avatar Dec 16 '23 12:12 slawekjaranowski