You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Ndacyayisenga-droid (via GitHub)" <gi...@apache.org> on 2025/04/23 03:29:15 UTC
[PR] MDEP-976: Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Ndacyayisenga-droid opened a new pull request, #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523
Fixes https://issues.apache.org/jira/browse/MDEP-976
Following this checklist to help us incorporate your
contribution quickly and easily:
- [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MDEP) 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.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
- [ ] Format the pull request title like `[MDEP-XXX] - Fixes bug in ApproximateQuantiles`,
where you replace `MDEP-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.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] 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](https://www.apache.org/licenses/icla.pdf) 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](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [ ] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MDEP-976] Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz commented on PR #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523#issuecomment-6024050451
Converted to draft: `prependGroupIdByDefault` is only ORed into `prependGroupId`, so it is a second switch for the same behaviour with the same default, and the question of why a new option is needed is still open. It also never reaches `DestFileFilter` in `getMarkedArtifactFilter()` (https://github.com/apache/maven-dependency-plugin/blob/master/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java#L385-L397), so the overwrite check uses names without the groupId.
What would make it ready: drop the new parameter and either fail the build on an actual overwrite or flip the `prependGroupId` default in a major, with an IT. Otherwise I'd close it; https://github.com/apache/maven-dependency-plugin/issues/1476 stays open.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MDEP-976: Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "cowwoc (via GitHub)" <gi...@apache.org>.
cowwoc commented on PR #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523#issuecomment-2838818489
@hboutemy It's possible for two different artifacts to have the same artifactId and version even though their groupId is different.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MDEP-976: Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "Ndacyayisenga-droid (via GitHub)" <gi...@apache.org>.
Ndacyayisenga-droid commented on PR #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523#issuecomment-2841064860
> notice: IIUC, the conflict happens only when stripVersion is enable, isn't it? then WARN if not stripVersion, because it warns about 2 groupIds that you can't really differentiate and ERROR if this leads to overwrite, as it is better to fail the build than keep a silent conflicted file overwritten
>
> WDYT of this behaviour poposal?
@hboutemy this might cause a lot of build failures, especially in cases where two different artifacts share the same artifactId.
I'm not sure. Is it actually valid in Maven for two different artifacts to have the same artifactId but different groupIds?.
I tried to reproduce the issue in this projecct https://github.com/Ndacyayisenga-droid/mdep-976 (just execute the script).
results
Current version

For my snapshot

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MDEP-976: Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on PR #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523#issuecomment-2837817422
notice: IIUC, the conflict happens only when stripVersion is enable, isn't it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MDEP-976] Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on PR #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523#issuecomment-2850703748
It absolutely is valid in Maven for two different artifacts to have the same artifact ID but different group IDs. Artifact IDs are not unique or intended to be. In fact, this is common with forked projects and likely occurs with other common artifact IDs like "utils".
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MDEP-976] Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523#discussion_r2079473159
##########
src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java:
##########
@@ -105,6 +105,15 @@ public class CopyDependenciesMojo extends AbstractFromDependenciesMojo {
@Parameter(property = "mdep.copySignatures", defaultValue = "false")
protected boolean copySignatures;
+ /**
+ * Prepend the groupId to the output filename by default to avoid conflicts when artifactIds are not globally unique.
+ * Set to false to retain the original behavior.
Review Comment:
It might be unclear to readers what the original behavior was.
##########
src/main/java/org/apache/maven/plugins/dependency/fromDependencies/CopyDependenciesMojo.java:
##########
@@ -144,25 +153,27 @@ protected void doExecute() throws MojoExecutionException {
DependencyStatusSets dss = getDependencySets(this.failOnMissingClassifierArtifact, addParentPoms);
Set<Artifact> artifacts = dss.getResolvedDependencies();
+ boolean effectivePrependGroupId = prependGroupId || prependGroupIdByDefault;
Review Comment:
why do we need both? One feels like it should be enough
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MDEP-976: Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "hboutemy (via GitHub)" <gi...@apache.org>.
hboutemy commented on PR #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523#issuecomment-2837814938
@Ndacyayisenga-droid please take time to review the checkboxes in the issue description and fill them as necessary: keeping them not checked is not useful
on adding a new option just for copy-dependencies, I'm not clear: why?
`prependGroupId` is the configuration the user did not know about
I'd prefer either we change the default value for `prependGroupId`, or we add code to detect when conflict happens and WARN with a hint on how to configure `prependGroupId`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MDEP-976] Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz commented on PR #523:
URL: https://github.com/apache/maven-dependency-plugin/pull/523#issuecomment-6152140718
Closing for now: the new parameter duplicates `prependGroupId` and doesn't reach the overwrite check, because `getMarkedArtifactFilter()` still uses `prependGroupId`. A PR that fails on an actual overwrite, or flips the default in a major release, with an IT, is welcome. #1476 stays open to track it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MDEP-976] Fix artifact overwrites in copy-dependencies [maven-dependency-plugin]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz closed pull request #523: [MDEP-976] Fix artifact overwrites in copy-dependencies
URL: https://github.com/apache/maven-dependency-plugin/pull/523
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org