apache / apache/maven-dependency-plugin

[MDEP-954] copy-/unpack-dependencies includeGroupIds also applies to "sub"-groupIds

Open
#1,463 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
175
Forks
196
Avg merge
19h 30m
Merged PRs (30d)
5

Description

**[Andreas Sewe](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=asewe)** opened **[MDEP-954](https://issues.apache.org/jira/browse/MDEP-954?redirect=false)** and commented

I am using `unpack-dependencies` in my project and just got bitten by the following unexpected behaviour:

`org.example` includes not just artifacts whose `groupId` is `{}org.example{`}, but also artifacts whose `groupId` is, say, `{}org.example.foo{`}.

I consider this a **bug** for several reasons:
1. This is, I believe, inconsistent with how similar `includes` on `{}groupId{`}s behave elsewhere in the Maven ecosystem (e.g., in [assembly descriptors](https://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html#advanced-artifact-matching-in-includes-and-excludes) or [enforcer rules](https://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html)).
2. This is also inconsistent with how `includeArtifactIds` behaves, where `maven` doesn't match `maven-core` either.
3. Last but not least, this makes it quite tricky to target `org.example` and `org.example.foo` by different `{}{`}s of `unpack-dependencies` or `{}copy-dependencies{`}. If `org.example`  comes first, it also processes all `org.example.foo` artifacts, causing the second execution with `org.example.foo` to be effectively ignored, as all `org.example.foo` artifacts have already left their trace in the `dependency-maven-plugin-markers` directory. (A **workaround** is careful reordering of the `` elements.)

Hence, please consider changing the interpretation of `includeGroupIds` (and `{}excludeGroupIds{`}, of course) and possibly also expanding the (sparse) [documentation](https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html#includeGroupIds) of the property.

---

**Affects:** 3.8.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the implementation and tests for includeGroupIds and excludeGroupIds in the copy-dependencies and unpack-dependencies goals. Verify how org.example is matched against org.example.foo, then update the behavior so group IDs match exactly and expand the includeGroupIds documentation; add or adjust coverage for both group IDs.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.