[
https://issues.apache.org/jira/browse/MNG-8024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17809977#comment-17809977
]
ASF GitHub Bot commented on MNG-8024:
-------------------------------------
gnodet commented on PR #1388:
URL: https://github.com/apache/maven/pull/1388#issuecomment-1906223854
> > Yes, that is exactly what is happening, the incremental build basically
taks "bits" of model and would like to serialize those with DataOutputStream...
>
> I'm not sure we should support this use case, as I think the whole model
will be serialised anyway. The lambdas in the list/properties objects do retain
a reference to the parent up to the Model. This is needed in order to implement
the modification methods while keeping the original reference.
>
> So while this may actually make things work, I'm not completely sure we
should do it... It may be easier to simplify check if there's a `getDelegate()`
method, and if so, serialize that object instead.
Another way would be to generate writeObject / readObject methods that will
actually delegate to... the delegates from the v4 model.
> Maven4 models are not serializable, despite marked as such
> ----------------------------------------------------------
>
> Key: MNG-8024
> URL: https://issues.apache.org/jira/browse/MNG-8024
> Project: Maven
> Issue Type: Bug
> Components: API
> Reporter: Tamas Cservenak
> Priority: Major
> Fix For: 4.0.0, 4.0.0-alpha-13
>
>
> Maven4 models are marked as {{{}Serializable{}}}, but they are not. Example:
> {noformat}
> Caused by: java.io.NotSerializableException:
> org.apache.maven.model.ModelBase$$Lambda/0x00007fd7ac284278
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1200)
> at
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1585)
> at
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1542)
> at
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1451)
> at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1194)
> at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:358)
> at
> io.takari.incrementalbuild.spi.DefaultBuildContextState.writeMap(DefaultBuildContextState.java:126)
> at
> io.takari.incrementalbuild.spi.DefaultBuildContextState.storeTo(DefaultBuildContextState.java:109)
> at
> io.takari.incrementalbuild.spi.AbstractBuildContext.commit(AbstractBuildContext.java:525)
> at
> io.takari.incrementalbuild.maven.internal.MavenBuildContextFinalizer.afterMojoExecutionSuccess(MavenBuildContextFinalizer.java:83)
> at
> org.apache.maven.execution.scope.internal.MojoExecutionScope.afterMojoExecutionSuccess(MojoExecutionScope.java:129)
> at
> org.apache.maven.plugin.CompoundMojoExecutionListener.afterMojoExecutionSuccess(CompoundMojoExecutionListener.java:42)
> {noformat}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)