hboutemy commented on code in PR #24:
URL: 
https://github.com/apache/maven-source-plugin/pull/24#discussion_r1541964048


##########
src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java:
##########
@@ -303,15 +304,24 @@ protected void packageSources(List<MavenProject> 
theProjects) throws MojoExecuti
             }
 
             if (attach) {
+                boolean requiresAttach = true;
                 for (Artifact attachedArtifact : 
project.getAttachedArtifacts()) {
-                    if (isAlreadyAttached(attachedArtifact, project, 
getClassifier())) {
-                        getLog().error("We have duplicated artifacts 
attached.");
-                        throw new MojoExecutionException("Presumably you have 
configured maven-source-plugin "
-                                + "to execute twice in your build. You have to 
configure a classifier "
-                                + "for at least one of them.");
+                    Artifact previouslyAttached = 
getPreviouslyAttached(attachedArtifact, project, getClassifier());
+                    if (previouslyAttached != null) {
+                        if (!outputFile.equals(previouslyAttached.getFile())) {

Review Comment:
   > you can attach twice the same artifact due to two executions 
   
   no, you can execute the goal twice (by running twice as `mvn install 
deploy`), but with the PR it won't attach the second time: then it won't try to 
deploy twice, then it won't fail if repository refuses to overwrite (I'm 
starting to guess it was the concrete. fact between vague MSOURCES-121 
description)
   
   you're right it could be called `ignoreAlreadyAttachedArtifact`
   
   so what you mean is that running `mvn install deploy` is one case of what 
you call "the build is broken"
   
   I'll approach it differently: you implicitely say MSOURCES-140 MSOURCES-141 
and MSOURCES-143 should be closed as either "fixed" or "invalid"?
   I'd love to get also feedback from people opening tickets, because I don't 
get what everybody is trying to achieve: I'm loosing my time trying to solve 
problems from otherss I don't have myself



-- 
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-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to