Andreas Sewe created MDEP-954:
---------------------------------

             Summary: copy-/unpack-dependencies includeGroupIds also applies to 
"sub"-groupIds
                 Key: MDEP-954
                 URL: https://issues.apache.org/jira/browse/MDEP-954
             Project: Maven Dependency Plugin
          Issue Type: Bug
          Components: copy-dependencies, unpack-dependencies
    Affects Versions: 3.8.0
         Environment: Apache Maven 4.0.0-beta-3 
(e92f645c2749eb2a4f5a8843cf01e7441e4b559f)
Java version: 17.0.12, vendor: Debian, runtime: 
/usr/lib/jvm/java-17-openjdk-amd64
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "5.10.0-32-amd64", arch: "amd64", family: "unix"

            Reporter: Andreas Sewe


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

{{<includeGroupIds>org.example</includeGroupIds>}} 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:
 # 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]).
 # This is also inconsistent with how {{includeArtifactIds}} behaves, where 
{{maven}} doesn't match {{maven-core}} either.
 # Last but not least, this makes it quite tricky to target {{org.example}} and 
{{org.example.foo}} by different {{{}<execution>{}}}s of 
{{unpack-dependencies}} or {{{}copy-dependencies{}}}. If 
{{<includeGroupIds>org.example</includeGroupIds>}}  comes first, it also 
processes all {{org.example.foo}} artifacts, causing the second execution with 
{{<includeGroupIds>org.example.foo</includeGroupIds>}} 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 {{<execution>}} 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to