Keep verbatim source blocks working with Doxia 1 - #245
Merged
slachiewicz merged 1 commit intoAug 8, 2026
Conversation
SinkEventAttributeSet.SOURCE was added in Doxia 2, replacing BOXED, so reading it ends in NoSuchFieldError whenever the Maven Site Plugin in use still provides Doxia 1. That is the same failure that MPIR issue 103 reported for verbatimText and verbatimLink, one method over, and it is reachable: maven-plugin-report-plugin calls verbatimSource. Build the attribute set instead. The decoration key and the varargs constructor both exist in Doxia 1 and 2, so the block renders as source on Doxia 2 as before, and degrades to a plain verbatim block on Doxia 1 rather than failing the report.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finishes what #243 started. That PR fixed
verbatimTextandverbatimLink, and called outverbatimSourceas the remaining half; this is it.SinkEventAttributeSet.SOURCEarrived in Doxia 2, where DOXIA-685 introduced it in place ofBOXED. Reading it therefore ends in aNoSuchFieldErrorwhenever the Maven Site Plugin in use still provides Doxia 1, since a report plugin renders with the Doxia the Site Plugin provides rather than its own. Maven 3.9.x still binds maven-site-plugin 3.12.1 by default, so that is the common case rather than an exotic one.Unlike the
verbatim()case, this one is not reachable from maven-project-info-reports-plugin, which is why apache/maven-project-info-reports-plugin#103 only ever showed the other symptom. It is reachable though:PluginOverviewRendererin maven-plugin-report-plugin callsverbatimSource.The change
Build the attribute set rather than reading the constant:
SinkEventAttributes.DECORATIONand the varargs constructor both exist in Doxia 1 and Doxia 2, andDECORATIONis a compile time String constant, so nothing here is resolved against a class that might be missing.Output is unchanged on Doxia 2: the constant holds exactly this attribute, and the existing integration test still asserts
<pre class="prettyprint"><code>…</code></pre>. On Doxia 1 the decoration valuesourceis simply not one it recognises, so the block renders as a plain verbatim block. Losing the styling there is a lot better than losing the report.Note this leaves #184 open, since building the set still needs
SinkEventAttributeSetfrom theimplpackage. That is a packaging problem, waiting on apache/maven-doxia#1073; this is a Doxia 1 versus 2 problem, and the two are independent.Test
The new test asserts both the attribute value and, with
assertNotSame, that the set is not the constant itself. The identity check is the part that matters: content alone would pass either way, since the constant carries the same attribute. Reverting the production change fails it:mvn verifygreen: unit tests, all 6 ITs, and rat.