olamy commented on a change in pull request #358:
URL: https://github.com/apache/maven/pull/358#discussion_r433710953



##########
File path: maven-core/src/main/java/org/apache/maven/project/MavenProject.java
##########
@@ -921,12 +926,20 @@ public void setInjectedProfileIds( String source, 
List<String> injectedProfileId
      * coordinates.
      *
      * @param artifact the artifact to add or replace.
-     * @throws DuplicateArtifactAttachmentException
+     * @deprecated Please use {@link MavenProjectHelper}
+     * @throws DuplicateArtifactAttachmentException not used anymore but leave 
it for backward compatibility
      */
     public void addAttachedArtifact( Artifact artifact )
         throws DuplicateArtifactAttachmentException
     {
-        getAttachedArtifacts().add( artifact );
+        // if already there we remove it and add again
+        int index = attachedArtifacts.indexOf( artifact );
+        if ( index > 0 )
+        {
+            LOGGER.warn( "artifact {} already attached, remove previous 
instance and add again" );
+            attachedArtifacts.set( index, artifact );
+        }
+        attachedArtifacts.add( artifact );

Review comment:
       argh I pushed the branch in the wrong repo




----------------------------------------------------------------
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.

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


Reply via email to