asciidoctor-maven-plugin icon indicating copy to clipboard operation
asciidoctor-maven-plugin copied to clipboard

Better error/warning log handling

Open ptahchiev opened this issue 7 years ago • 8 comments

At the moment when I run mvn clean site site:deploy I get this in my log:

[INFO] Rendering 28 Doxia documents: 28 asciidoc
asciidoctor: WARNING: <stdin>: line 20: no callouts refer to list item 1
asciidoctor: WARNING: <stdin>: line 22: no callouts refer to list item 2
asciidoctor: WARNING: <stdin>: line 25: no callouts refer to list item 3
asciidoctor: ERROR: <stdin>: line 106: invalid part, must have at least one section (e.g., chapter, appendix, etc.)

You can see I am rendering 28 documents, and I have errors and warnings in some of them. I can see the line, however I don't know which file is problematic.

ptahchiev avatar Oct 24 '17 09:10 ptahchiev

It's not the first time we see problems with this. If you see the Doxia module (https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/3d447538193a17c2cceaa25a98c38c514d470f6f/src/main/java/org/asciidoctor/maven/site/AsciidoctorParser.java#L64), it provides a Reader object, so we cannot access to the File to log the path it in the same way we do in the default mojo. The only thing I have found is running Maven in debug mode ('-X'), that way you see a

[DEBUG] Generating C:\home\personal\github\asciidoctor-maven-examples\asciidoc-maven-site-example\target\site\article222.html

It's not the source but the output, but you can see the filename at least and guess the file.

I just checked if there was something new in the Doxia documentation, but found nothing. Maybe there's a way to access the source or some info to log it, but needs further research into Doxia code.

abelsromero avatar Oct 24 '17 15:10 abelsromero

We will try to address this in related to DOXIA-555 issue.

slachiewicz avatar Mar 04 '18 21:03 slachiewicz

With Asciidoctorj 1.5.8.x new messages that include the file path are shown in the console, which partially resolves this issue. However, this is not ideal and creates a difference with the process-asciidoc mojo which has more advanced features (see logHandler). For that, I will keep this open to integrate logHandler in the site mojo, I started a POC, but there are some issues with the doxia logger vs maven logger witch may require some boilerplate with Java7. I am moving this to 1.6.0 witch will require Java8 making things easier and cleaner.

abelsromero avatar Dec 30 '18 19:12 abelsromero

I did the preoviously mentioned logHandler integration and I hit again the limitations of the Doxia module (unable to get the filename :%). One thing however, is that if you enable the build to fail Doxia will catch the first file that failed and at least show that. Far from perfect, I know. Also I am keeping an eye on the related DOXIA-555 issue but no progress yet.

For those reasons I will keep this open but reschedule for future realease in case something comes up.

abelsromero avatar Jun 17 '20 21:06 abelsromero

Fix is on the works: https://github.com/apache/maven-doxia/pull/35

abelsromero avatar Oct 11 '20 18:10 abelsromero

We are still chasing this, this should make it possible finally https://github.com/apache/maven-doxia-sitetools/pull/19. At least I got it working in a local example overriding doxia-site-renderer (local patched version) and doxia-core (v1.11.1) for maven-site-plugin.

abelsromero avatar Dec 21 '21 21:12 abelsromero

Doxia improvements are already in v2.2.5 and older versions.

abelsromero avatar Jan 13 '24 10:01 abelsromero

Reference is still obtained as null, need to see why. Setting as milestone as a reminder, will remove if some other Doxia element is still missing.

abelsromero avatar Jan 27 '24 14:01 abelsromero