You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Chapman Flack (JIRA)" <ji...@apache.org> on 2018/09/21 23:07:00 UTC

[jira] [Comment Edited] (MANTRUN-207) scriptdef ignores CDATA when there is also an element

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

Chapman Flack edited comment on MANTRUN-207 at 9/21/18 11:06 PM:
-----------------------------------------------------------------

This is pretty straightforward; the code that needs to be fixed is [here|http://svn.apache.org/viewvc/maven/plugins/tags/maven-antrun-plugin-1.8/src/main/java/org/apache/maven/plugin/antrun/AntrunXmlPlexusConfigurationWriter.java?revision=1646987&view=markup#l56].

 

Note that if there are no children (the 'if' branch) the work of writing is done by writeTag(), which writes the attributes _and the value_ (which is the script text!). But if any children exist (for scriptdef, that would be any 'attribute' element or 'element' element), the writing is done in the 'else' branch, which writes the attributes and the children, but _never writes the value_! The result is that the written file contains all of the scriptdef configuration except, well, the script.

That 'else' branch needs a copy of lines 83-87, before it calls endElement().


was (Author: jcflack):
This is pretty straightforward; the code that needs to be fixed is [here|[http://svn.apache.org/viewvc/maven/plugins/tags/maven-antrun-plugin-1.8/src/main/java/org/apache/maven/plugin/antrun/AntrunXmlPlexusConfigurationWriter.java?revision=1646987&view=markup#l56].]

 

Note that if there are no children (the 'if' branch) the work of writing is done by writeTag(), which writes the attributes _and the value_ (which is the script text!). But if any children exist (for scriptdef, that would be any 'attribute' element or 'element' element), the writing is done in the 'else' branch, which writes the attributes and the children, but _never writes the value_! The result is that the written file contains all of the scriptdef configuration except, well, the script.

That 'else' branch needs a copy of lines 83-87, before it calls endElement().

> scriptdef ignores CDATA when there is also an element
> -----------------------------------------------------
>
>                 Key: MANTRUN-207
>                 URL: https://issues.apache.org/jira/browse/MANTRUN-207
>             Project: Maven Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8
>         Environment: Windows 10 64bit, java 1.8.0_151, maven 3.5.0
>            Reporter: Matteo Steccolini
>            Priority: Major
>         Attachments: build-main.xml, pom.xml
>
>
> When I put a CDATA node inside a scriptdef which has also an element node, the cdata is ignored. You can see it in the attached build-main.xml that is generated from the attached pom.xml (mvn antrun:run@hello).
> When I though I might be doing something wrong I wrote this question on stackoverflow: [https://stackoverflow.com/questions/47796805/maven-antrun-plugin-scriptdef-ignores-cdata-when-i-add-an-element]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)