[ 
https://issues.apache.org/jira/browse/MNG-7316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17539501#comment-17539501
 ] 

Christoph Läubrich edited comment on MNG-7316 at 5/19/22 12:10 PM:
-------------------------------------------------------------------

Just to add another use-case here, [Tycho also was hit bit this 
problem|https://github.com/eclipse/tycho/issues/261], and yes as written down 
here it is not documented that the attached artifacts list is mutable.

We currently use the same workaround by reflectivly call the 
setAttachedArtifacts 
[https://github.com/eclipse/tycho/blob/48b0737c0710dec4331934a1b4ffec2813716f5b/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/BaselineValidator.java#L149-L167]
 here.

The rationale here is, that we do a "baseline replace" that means we compare 
the artifacts produced to a baseline version and if it is equal enough it gots 
replaced by the baseline version so the final artifact is bit-by-bit equivalent 
to the baseline.

So maybe the solution here could be to simply make _setAttachedArtifacts_ 
public?


was (Author: laeubi):
Just to add another use-case here, Tycho also was hit bit this problem, and yes 
as written down here it is not documented that the attached artifacts list is 
mutable.

We currently use the same workaround by reflectivly call the 
setAttachedArtifacts 
[https://github.com/eclipse/tycho/blob/48b0737c0710dec4331934a1b4ffec2813716f5b/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/BaselineValidator.java#L149-L167]
 here.

The rationale here is, that we do a "baseline replace" that means we compare 
the artifacts produced to a baseline version and if it is equal enough it gots 
replaced by the baseline version so the final artifact is bit-by-bit equivalent 
to the baseline.

So maybe the solution here could be to simply make _setAttachedArtifacts_ 
public?

> MavenProject.getAttachedArtifacts() regression with 3.8.1
> ---------------------------------------------------------
>
>                 Key: MNG-7316
>                 URL: https://issues.apache.org/jira/browse/MNG-7316
>             Project: Maven
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.8.2, 3.8.3
>            Reporter: Gary D. Gregory
>            Priority: Critical
>             Fix For: waiting-for-feedback, wontfix-candidate
>
>
> The method {{MavenProject.getAttachedArtifacts()}} as of 3.8.2 breaks 
> releasing components for us at Apache Commons using our Maven Release plugin 
> because the list returned is now immutable, we now get an exception when 
> calling {{remove()}} on the collection returned by the API; see 
> [https://github.com/apache/commons-release-plugin/blob/master/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java#L137]
> This worked fine in 3.8.1, may you please change it back for 3.8.4?
> We cannot use Maven 3.8.2 and 3.8.3 to release our components.
> ([~michael-o]: Ironically, I discovered this trying to create a release 
> candidate for Apache Commons CLI.)
> The exception in 3.8.3:
> {quote}Caused by: java.lang.UnsupportedOperationException
>  at java.util.Collections$UnmodifiableCollection.remove 
> (Collections.java:1060)
>  at 
> org.apache.commons.release.plugin.mojos.CommonsDistributionDetachmentMojo.execute
>  (CommonsDistributionDetachmentMojo.java:136)
>  at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
> (DefaultBuildPluginManager.java:137)
> {quote}
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to