You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Dan Taylor <Da...@Merge.com> on 2013/09/18 18:05:59 UTC

RE: bug in parsing file ... comments

Hi Brian,

>From the XML specification, specifically the section dealing with comments (http://www.w3.org/TR/REC-xml/#sec-comments), what you have below is not a viable XML file:

-----

2.5 Comments

[Definition: Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string " -- " (double-hyphen) must not occur within comments.] Parameter entity references must not be recognized within comments.

-----

So I doubt there is any way that maven can provide a fix that will suit your needs as any changes they make would cause their XML parser to be non-conformant to the XML specification.

Given the specific case you were targeting with your request, perhaps change "--gen" to "==gen" with note at the start of the comment along the lines of "all instances of == within this comment must be changed to -- when uncommenting".

Hope this helps,

Dan

-----Original Message-----
From: Brian Withnell [mailto:bwithnell@42six.com] 
Sent: Tuesday, September 17, 2013 2:46 PM
To: issues@maven.apache.org
Subject: bug in parsing file ... comments

We ran into a parsing bug that prevents commenting out an option with a command line for maven. We tried commenting out (for testing purposes) the following plugin, which contains the "thrift --gen" command. The "--gen"
caused a parse error in the file (looks like it thinks it needs to have --> because it is in a comment rather than --> as the only thing that matters.
It would be *great* if it allowed nesting of comments, but I'll take that it just doesn't barf on valid command structures. Because the following is a comment, you *should* be able to paste it into any pom file and have maven process the file properly.

      <!--  plugin>

        <artifactId>maven-compiler-plugin</artifactId>

        <version>3.1</version>

        <configuration>

          <source>1.6</source>

          <target>1.6</target>

        </configuration>

      </plugin -->

      <!-- plugin>

        <artifactId>maven-antrun-plugin</artifactId>

        <executions>

          <execution>

            <id>generate-sources</id>

            <phase>generate-sources</phase>

            <configuration>

              <tasks>

                <mkdir dir="target/generated-sources/" />

                <apply executable="/usr/local/bin/thrift" parallel="false">

the line below in a comment causes problems:

                  <arg value="--gen" />

                  <arg value="java" />

                  <arg value="-out" />

                  <arg value="target/generated-sources/" />

                  <fileset dir="src/">

                    <include name="*.thrift" />

                  </fileset>

                </apply>

              </tasks>

            </configuration>

            <goals>

              <goal>run</goal>

            </goals>

          </execution>

        </executions>

      </plugin -->

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org