You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christoph Läubrich (Jira)" <ji...@apache.org> on 2024/09/08 16:17:00 UTC

[jira] [Comment Edited] (MNG-8253) ModelReader based Models are not readable anymore later in the build

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

Christoph Läubrich edited comment on MNG-8253 at 9/8/24 4:16 PM:
-----------------------------------------------------------------

e.g. if a model file is actually a directory this will confuse maven:

{code}Caused by: java.io.IOException: Ist ein Verzeichnis
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:330)
    at sun.nio.ch.IOUtil.read(IOUtil.java:296)
    at sun.nio.ch.IOUtil.read(IOUtil.java:273)
    at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:232)
    at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
    at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:107)
    at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:101)
    at java.io.InputStream.read(InputStream.java:218)
    at org.apache.maven.internal.transformation.impl.TransformedArtifact.sha1(TransformedArtifact.java:133)
    at org.apache.maven.internal.transformation.impl.TransformedArtifact.mayUpdate(TransformedArtifact.java:116)
    at org.apache.maven.internal.transformation.impl.TransformedArtifact.getFile(TransformedArtifact.java:95)
{code}


was (Author: laeubi):
e.g. if a model file is actually a directory this will confuse maven:

Caused by: org.apache.maven.internal.transformation.TransformationFailedException: java.io.IOException: Ist ein Verzeichnis
    at org.apache.maven.internal.transformation.impl.TransformedArtifact.getFile(TransformedArtifact.java:101)


> ModelReader based Models are not readable anymore later in the build
> --------------------------------------------------------------------
>
>                 Key: MNG-8253
>                 URL: https://issues.apache.org/jira/browse/MNG-8253
>             Project: Maven
>          Issue Type: Improvement
>            Reporter: Christoph Läubrich
>            Priority: Major
>
> Assume you have a ModelReader that reads a custom file (e.g. json, yaml, ...) this currently seem to result in the ModelReader Source#getPath being used as the "file model" for the POM.
> This confuses some parts of maven (especially plugins) as they assume that this file is always an POM XML.
> In maven-polyglot, this was circumvented by writing out the model as XML in a file named .polyglot.<name of model file>.xml and this was set as the model file.
> This also has had some drawbacks (that an extra file is generated (and possibly deleted after the build)) , but retained the semantics of Model#getFile to return an (xml readable) model.
> As maven4 now uses Path, one way would be to hold the model in an in-memory path representation so that "reading" that path as a model again will simply return a copy, but as a first iteration using an approach similar to what polyglot does might be sufficient.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)