asciidoctor-maven-plugin: Asciidoc maven site integration fails to render with maven-site-plugin 3.10.0

What is this issue about?

  • Bug report
  • Feature request
  • Question

Description When updating the maven-site-plugin from 3.9.1 to 3.10.0 the asciidoc-maven-plugin fails to render the site when integrated with the maven-site-plugin. The new plugin comes with an updated doxia, so this might be the issue.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.10.0:site (default-site) on project test-site-asciidoc: Error parsing '/[...]/tracing-playground/test-site-asciidoc/src/site/asciidoc/test.adoc': line [1] Error parsing the model: only whitespace content allowed before start tag and not = (position: START_DOCUMENT seen =... @1:1)  -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.10.0:site (default-site) on project test-site-asciidoc: Error parsing '/[...]/tracing-playground/test-site-asciidoc/src/site/asciidoc/test.adoc': line [1] Error parsing the model: only whitespace content allowed before start tag and not = (position: START_DOCUMENT seen =... @1:1) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error parsing '/[...]/test-site-asciidoc/src/site/asciidoc/test.adoc': line [1] Error parsing the model: only whitespace content allowed before start tag and not = (position: START_DOCUMENT seen =... @1:1) 
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:153)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.doxia.siterenderer.RendererException: Error parsing '/[...]/test-site-asciidoc/src/site/asciidoc/test.adoc': line [1] Error parsing the model: only whitespace content allowed before start tag and not = (position: START_DOCUMENT seen =... @1:1) 
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderDocument (DefaultSiteRenderer.java:450)
    at org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer.renderDocument (DoxiaDocumentRenderer.java:52)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:348)
    at org.apache.maven.plugins.site.render.SiteMojo.renderDoxiaDocuments (SiteMojo.java:286)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:184)
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:143)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.doxia.parser.ParseException: Error parsing the model: only whitespace content allowed before start tag and not = (position: START_DOCUMENT seen =... @1:1) 
    at org.apache.maven.doxia.parser.AbstractXmlParser.parse (AbstractXmlParser.java:146)
    at org.apache.maven.doxia.parser.XhtmlBaseParser.parse (XhtmlBaseParser.java:92)
    at org.apache.maven.doxia.module.xhtml.XhtmlParser.parse (XhtmlParser.java:358)
    at org.apache.maven.doxia.DefaultDoxia.parse (DefaultDoxia.java:72)
    at org.apache.maven.doxia.DefaultDoxia.parse (DefaultDoxia.java:60)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderDocument (DefaultSiteRenderer.java:435)
    at org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer.renderDocument (DoxiaDocumentRenderer.java:52)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:348)
    at org.apache.maven.plugins.site.render.SiteMojo.renderDoxiaDocuments (SiteMojo.java:286)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:184)
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:143)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: only whitespace content allowed before start tag and not = (position: START_DOCUMENT seen =... @1:1) 
    at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog (MXParser.java:1864)
    at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl (MXParser.java:1700)
    at org.codehaus.plexus.util.xml.pull.MXParser.nextToken (MXParser.java:1326)
    at org.apache.maven.doxia.parser.AbstractXmlParser.parseXml (AbstractXmlParser.java:273)
    at org.apache.maven.doxia.parser.AbstractXmlParser.parse (AbstractXmlParser.java:141)
    at org.apache.maven.doxia.parser.XhtmlBaseParser.parse (XhtmlBaseParser.java:92)
    at org.apache.maven.doxia.module.xhtml.XhtmlParser.parse (XhtmlParser.java:358)
    at org.apache.maven.doxia.DefaultDoxia.parse (DefaultDoxia.java:72)
    at org.apache.maven.doxia.DefaultDoxia.parse (DefaultDoxia.java:60)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderDocument (DefaultSiteRenderer.java:435)
    at org.apache.maven.doxia.siterenderer.DoxiaDocumentRenderer.renderDocument (DoxiaDocumentRenderer.java:52)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:348)
    at org.apache.maven.plugins.site.render.SiteMojo.renderDoxiaDocuments (SiteMojo.java:286)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:184)
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:143)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

Environment information

  • asciidoctor-maven-plugin version: 2.2.1
  • asciidoctorj version: as provided by plugin
  • Maven, Java and OS version: Java version: 11.0.13, vendor: Eclipse Adoptium, runtime: /home/christianf1/dev/java/jdk-11.0.13+8 Default locale: en_US, platform encoding: UTF-8 OS name: “linux”, version: “5.4.0-92-generic”, arch: “amd64”, family: “unix”

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Many thanks @ChristianLMI @michael-o for your patience and support! 🙇 I’ll try to make a release lo later than next week.

Here is the patch:

diff --git a/pom.xml b/pom.xml
index cfc1eeb..14a0b5c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
         <name>Asciidoctor</name>
         <url>https://asciidoctor.org/</url>
     </organization>
-    
+
     <developers>
         <developer>
             <id>lightguard</id>
@@ -76,7 +76,7 @@
         <plexus.utils.version>3.0.23</plexus.utils.version>
         <plexus.component.metadata.version>1.7</plexus.component.metadata.version>
         <netty.version>4.1.59.Final</netty.version>
-        <doxia.version>1.8</doxia.version>
+        <doxia.version>1.10</doxia.version>
     </properties>
 
     <dependencyManagement>
@@ -143,11 +143,6 @@
             <artifactId>doxia-core</artifactId>
             <version>${doxia.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.maven.doxia</groupId>
-            <artifactId>doxia-module-xhtml</artifactId>
-            <version>${doxia.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter</artifactId>
diff --git a/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java b/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java
index cd99b2e..1546d5f 100644
--- a/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java
+++ b/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java
@@ -1,6 +1,6 @@
 package org.asciidoctor.maven.site;
 
-import org.apache.maven.doxia.module.xhtml.XhtmlParser;
+import org.apache.maven.doxia.parser.AbstractTextParser;
 import org.apache.maven.doxia.parser.ParseException;
 import org.apache.maven.doxia.parser.Parser;
 import org.apache.maven.doxia.sink.Sink;
@@ -31,7 +31,7 @@ import java.util.logging.Logger;
  * @author mojavelinux
  */
 @Component(role = Parser.class, hint = AsciidoctorDoxiaParser.ROLE_HINT)
-public class AsciidoctorDoxiaParser extends XhtmlParser {
+public class AsciidoctorDoxiaParser extends AbstractTextParser {
 
     @Inject
     protected Provider<MavenProject> mavenProjectProvider;
@@ -45,7 +45,7 @@ public class AsciidoctorDoxiaParser extends XhtmlParser {
      * {@inheritDoc}
      */
     @Override
-    public void parse(Reader reader, Sink sink) throws ParseException {
+    public void parse(Reader reader, Sink sink, String reference) throws ParseException {
         String source;
         try {
             if ((source = IOUtil.toString(reader)) == null) {

Rolling back the change is likely the way to go, but involves a lot of work for a “simple” thing for me which will take the course of at least 10 days and a full working day, not going to happen unless extremely necessary. This is the only complaint so far. Above you have a patch how to properly solve it in this. It should have been a text parser from begin with. Moreover, using the sink raw text is logically wrong. Assuming that the sink is always HTML. Wrong. Look at our bundled MarkdownParser. The contributor was pretty smart, I must admit! He converts from MD to HTML and then passes to an XHTML parser which will handle ALL events for the Sink. Awesome. I highly recommend evaluting this approach for 2.3.0.

In that case we are fine then since we’ll be extending AbstractParser directly. And to tell the truth I am pretty sure we are abusing the doxia module system, we just use our own parser/coverter and inject the html generated as-is (no Sink).

I know, that is why I partially question this system as a whole, but I need to do this step by step. At the end, no one needs a second pandoc. What we basically need is to read format X and transform to HTML5, that’s it. No Swiss army knife.

I created a fix for the our module by simply extending from AbstractParser instead of XhtmlParser. I am intrigued by what is causing the issue with doxia 1.11.1, but it’s consistent with not being able to parse XML (since we are not XML) and directly extending from AbstractParser makes much more sense. @michael-o if you think it’s worth looking more into it and I put some time in the weekend.

I’ll leave the PR open a couple of days for review.

Give me a couple of days to digest. My head is currently filled with other stuff.

Maybe we need to revert the commit in Doxia 1.x and have it in 2.x only.

I am looking right now, but I need some time to make memory 😅

@abelsromero Here is the failure:

$ git bisect good
497a4387007732ffe5c780451cbc3778c9e0b265 is the first bad commit
commit 497a4387007732ffe5c780451cbc3778c9e0b265
Author: Abel Salgado Romero <abelromero@gmail.com>
Date:   Mon Jun 29 19:51:37 2020 +0200

    [DOXIA-614] Support passing source reference to Doxia instance

    Closes #35

 .../java/org/apache/maven/doxia/DefaultDoxia.java  | 10 +++-
 .../main/java/org/apache/maven/doxia/Doxia.java    | 14 ++++++
 .../org/apache/maven/doxia/DefaultDoxiaTest.java   | 54 ++++++++++++++++++++++
 3 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 doxia-core/src/test/java/org/apache/maven/doxia/DefaultDoxiaTest.java

Please figure out whether this is a bug in the Asciidoctor Doxia Module or in Doxia itself.