Skip to content

Docs: Wrap </> Modello descriptions in CDATA block - #13678

Closed
JackPGreen wants to merge 2 commits into
apache:masterfrom
JackPGreen:wrap-`<`/`>`-modello-descriptions-in-cdata
Closed

JackPGreen wants to merge 2 commits into
apache:masterfrom
JackPGreen:wrap-`<`/`>`-modello-descriptions-in-cdata

Conversation

@JackPGreen

@JackPGreen JackPGreen commented Oct 22, 2026 •

Copy link
Copy Markdown

For angle braces (</>) to be rendered correctly by Modello, they must be escaped by their HTML equivalents and then places inside a CDATA block, e.g.:

<description>
<![CDATA[
The <code>&lt;proxy&gt;</code> element contains informations required to a proxy settings.
]]></description>

However, not all are like this - which causes them to be rendered incorrectly:
Image

Updated all &lt;/&gt; Modello usages to resolve:
image

Fixes: #13675

For angle braces (`<`/`>`) to be rendered correctly by Modello, they must be escaped by their HTML equivalents and then places inside a CDATA block, e.g.: https://github.com/apache/maven/blob/f6a012024f53177374f35a86f337b0e6e8e57bb4/maven-settings/src/main/mdo/settings.mdo#L424-L427

However, not all are like this - which causes them to be rendered incorrectly:
<img width="999" height="258" alt="Image" src="https://github.com/user-attachments/assets/04e64a6a-7a3e-4e3b-80fe-2ab38a1063c6" />

Updated all `&lt;`/`&gt;` Modello usages to resolve:
<img width="979" height="219" alt="image" src="https://github.com/user-attachments/assets/b168c216-7582-4734-9383-0a5bfcbeb911" />

Fixes: apache#13675

- [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
- [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
@JackPGreen JackPGreen changed the title Wrap &lt;/&gt; Modello descriptions in CDATA block Docs: Wrap &lt;/&gt; Modello descriptions in CDATA block Oct 22, 2026

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maven.mdo now has inconsistent > escaping — this new line uses &lt;project&gt; (both brackets HTML-escaped), while several existing descriptions in the same file use only &lt; with a raw > (e.g. &lt;build>, &lt;scm>, &lt;plugin>, &lt;groupId>:&lt;artifactId>:&lt;version>). Worth aligning across the file for consistency, but not a blocker.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

<description>
The {@code &lt;project>} element is the root of the descriptor.
<![CDATA[
The {@code &lt;project&gt;} element is the root of the descriptor.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Nit: This line uses &lt;project&gt; (both angle brackets HTML-escaped), but other descriptions in this file use &lt;build>, &lt;scm>, &lt;plugin>, etc. — only < is escaped, > is raw. Worth picking one convention and applying it consistently across all description blocks.

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build fails because of incomplete escaping in maven.mdo. Several descriptions were wrapped in CDATA blocks but still contain the half-escaped form &lt;name> (opening < escaped, closing > raw).

Inside a CDATA block the XML parser passes content verbatim — &lt; is not decoded, so Modello's javadoc generator emits the literal string &lt;name> into the generated Java class's Javadoc comment. Javadoc then sees <name> as an unknown HTML element and rejects it with error: unexpected content on the generated ModelBase.java (lines 72 and 180) and Mixin.java (empty comment warning).

For example, in maven.mdo the properties field description:

The format is {@code &lt;name>value&lt;/name>}.

Inside CDATA this should be either:

  • {@code &lt;name&gt;value&lt;/name&gt;} — both brackets escaped, OR
  • {@code <name>value</name>} — raw angle brackets (CDATA protects them at the XML level, and {@code} protects them at the Javadoc level)

The same half-escaped pattern likely appears in all the descriptions touched in this PR. Please audit every &lt;...> (where > is unescaped) within the newly added CDATA blocks and fix the escaping consistently.

@JackPGreen

Copy link
Copy Markdown
Author

Nit: maven.mdo now has inconsistent > escaping — this new line uses &lt;project&gt; (both brackets HTML-escaped), while several existing descriptions in the same file use only &lt; with a raw > (e.g. &lt;build>, &lt;scm>, &lt;plugin>, &lt;groupId>:&lt;artifactId>:&lt;version>).

This isn't new, e.g.:

<p>When a profile is activated and defines properties (via {@code &lt;properties&gt;}),

But I think this change just exposes the issue.

Please audit every &lt;...> (where > is unescaped) within the newly added CDATA blocks and fix the escaping consistently.

Audited using AI-generated command:

% find . -type f -name '*.mdo' -exec perl -0777 -ne '
    while (/<!\[CDATA\[(.*?)\]\]>/sg) {
        $block = $1;
        $start = $-[0];

        $line = 1 + (substr($_, 0, $start) =~ tr/\n/\n/);

        @lines = split /\n/, $block, -1;
        for ($i = 0; $i < @lines; $i++) {
            print "$ARGV:" . ($line + $i) . ": $lines[$i]\n"
                if $lines[$i] =~ /[<>]/ && $lines[$i] =~ /&(?:lt|gt);/;
        }
    }
' {} +

Fixed in fcbc1eb.

I was not able to reproduce this failure locally (e.g. mvn package site -DskipTests completes unexceptionally) to validate further, so 🤞 for CI result.

@slachiewicz

Copy link
Copy Markdown
Member

maybe this shoudl be fixed in Modello?

@JackPGreen

Copy link
Copy Markdown
Author

I was not able to reproduce this failure locally (e.g. mvn package site -DskipTests completes unexceptionally) to validate further, so 🤞 for CI result.

CI failed, maybe this is the wrong solution after all.

maybe this shoudl be fixed in Modello?

I wasn't able to validate if it was a bug or a misconfiguration.

<description>
The {@code &lt;project>} element is the root of the descriptor.
<![CDATA[
The {@code &lt;project&gt;} element is the root of the descriptor.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something's seriously off here, maybe Modello? The greater than sign can be but DOES NOT HAVE TO BE escaped in XML.

Properties that can be used throughout the POM as a substitution, and
are used as filters in resources if enabled.
The format is {@code &lt;name>value&lt;/name>}.
The format is {@code &lt;name&gt;value&lt;/name&gt;}.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is absolutely broken. The way this is structured It is requesting literal amspersands in the output, not less than and greater than signs.

@gnodet

gnodet commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Thanks for the investigation! After tracing the full rendering pipeline I've found that the root cause is in Modello's xdoc generator, not in the .mdo descriptions. The .mdo files are correct as written.

Root cause trace:

  1. MXParser reads <description> outside CDATA and XML-decodes &lt; → <, so {@code &lt;activation&gt;} becomes the string {@code <activation>}.
  2. XdocGenerator.rewrite() passes this to the chhorz javadoc-parser which wraps {@code X} in <code>X</code> without HTML-escaping X → produces <code><activation></code>.
  3. Jsoup (XML output mode) treats <activation> as an unknown HTML element and silently drops it.

Fix: I've opened a PR against Modello to pre-process {@code} / {@literal} tags and HTML-escape their content before the parser+Jsoup pipeline: codehaus-plexus/modello#619

This PR (wrapping in CDATA + double-escaping) is not the right approach — it adds complexity and changes the semantics of the descriptions without addressing the underlying Modello bug. Once Modello 2.8.2 ships with the fix, the Maven site will render correctly without any changes here.

I'll close this PR in favour of the upstream Modello fix.

@gnodet

gnodet commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Closing in favour of the upstream Modello fix: codehaus-plexus/modello#619

@gnodet gnodet closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs - repositoryOrigin description not rendered correctly

5 participants