You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Include file resolution
If the include directive is used in the primary (top-level) document, relative paths are resolved relative to the base directory. (The base directory defaults to the directory of the primary document and can be overridden from the CLI or API).
If the include directive is used in a file that has itself been included, the path is resolved relative to the including (i.e., current) file."
I have found a bug regarding the above specification:
[INFO] --- asciidoctor-maven-plugin:2.2.2:process-asciidoc (output-html) @ templateengine ---
2022-11-06T09:33:27.087+01:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\01_introduction_and_goals.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\02_architecture_constraints.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\03_system_scope_and_context.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\04_solution_strategy.adoc
[INFO] asciidoctor: DEBUG: Finding 'dot' in attributes
[INFO] asciidoctor: DEBUG: Finding 'dot' in environment
[INFO] asciidoctor: DEBUG: Found 'D:\Programme\Graphviz\bin/dot.EXE' in environment
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\05_building_block_view.adoc
[INFO] asciidoctor: DEBUG: Finding 'dot' in attributes
[INFO] asciidoctor: DEBUG: Finding 'dot' in environment
[INFO] asciidoctor: DEBUG: Found 'D:\Programme\Graphviz\bin/dot.EXE' in environment
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\06_runtime_view.adoc
[INFO] asciidoctor: DEBUG: Finding 'dot' in attributes
[INFO] asciidoctor: DEBUG: Finding 'dot' in environment
[INFO] asciidoctor: DEBUG: Found 'D:\Programme\Graphviz\bin/dot.EXE' in environment
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\07_deployment_view.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\08_concepts.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\09_architecture_decisions.adoc
[INFO] asciidoctor: DEBUG: Finding 'dot' in attributes
[INFO] asciidoctor: DEBUG: Finding 'dot' in environment
[INFO] asciidoctor: DEBUG: Found 'D:\Programme\Graphviz\bin/dot.EXE' in environment
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\10_quality_requirements.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\11_technical_risks.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\12_glossary.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\about-arc42.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\architecture\config.adoc
[INFO] asciidoctor: DEBUG: Finding 'dot' in attributes
[INFO] asciidoctor: DEBUG: Finding 'dot' in environment
[INFO] asciidoctor: DEBUG: Found 'D:\Programme\Graphviz\bin/dot.EXE' in environment
[INFO] asciidoctor: ERROR: architecture\06_runtime_view.adoc: line 51: include file not found: D:/work/eclipse/java/TemplateEngine/src/site/test/java/de/powerstat/phplib/templateengine/test/TemplateEngineTests.java
[INFO] asciidoctor: DEBUG: index.adoc: line 65: unknown name for block macro:
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\index.adoc
[INFO] Converted D:\work\eclipse\java\TemplateEngine\src\site\asciidoc\TemplateEngine.adoc
So now lets compare the error (path) from both outputs:
[INFO] asciidoctor: ERROR: architecture\06_runtime_view.adoc: line 51: include file not found: D:/work/eclipse/java/TemplateEngine/test/java/de/powerstat/phplib/templateengine/test/TemplateEngineTests.java
src is missing in the path [INFO] asciidoctor: ERROR: architecture\06_runtime_view.adoc: line 51: include file not found: D:/work/eclipse/java/TemplateEngine/src/site/test/java/de/powerstat/phplib/templateengine/test/TemplateEngineTests.java
site is to much in the path
What you can see is that in both cases the path is wrong!
But the interesting thing is that this happens at two different positions in the output. So I assume that a two phase processing happens.
That results to a bug, because in both phases you are working with different base directories!
In the first pass with: projectBase/src/site/asciidoc/ (like set in sourceDirectory - the only correct value)
In the second pass with: projectBase/src/site/asciidoc/architecture/ (Not sure if this is the config.adoc path or the one of the 06_runtime_view.adoc - wrong in both cases)
Would be nice to fix this bug to allow asciidoc includes within subdirectory structures. Might be an upstream issue for the maven plugin.
The same happens under Windows as well as on MacOS (so I assume also on Linux).
Thanks a lot for the thorough detail, this helps a lot!
This case is expected behaviour but can be improved and changed since we are working towards 3.x.x.
The maven-plugin and site modules work differently than the Ruby cli because the nature is slightly different. Here the goal is converting sets of documents, so some common configurations are kept across them to simplify. Similar to how you have a single catalog for all images with a well-defined root path.
But I admit this can be opinionated and it's normal to get confused.
What is this issue about?
Description
Regarding the description at:
https://docs.asciidoctor.org/asciidoc/latest/directives/include/
"Include file resolution
If the include directive is used in the primary (top-level) document, relative paths are resolved relative to the base directory. (The base directory defaults to the directory of the primary document and can be overridden from the CLI or API).
If the include directive is used in a file that has itself been included, the path is resolved relative to the including (i.e., current) file."
I have found a bug regarding the above specification:
As an example please have a look at:
https://github.com/PowerStat/TemplateEngine/tree/master/src/
When I now add the following include to 06_runtime_view.adoc:
include::../../../test/java/de/powerstat/phplib/templateengine/test/TemplateEngineTests.java[tag=NonAppendBlock]
this results in the following output:
So now I change the include to (one less dir level up):
include::../../test/java/de/powerstat/phplib/templateengine/test/TemplateEngineTests.java[tag=NonAppendBlock]
This results in the following output:
So now lets compare the error (path) from both outputs:
[INFO] asciidoctor: ERROR: architecture\06_runtime_view.adoc: line 51: include file not found: D:/work/eclipse/java/TemplateEngine/test/java/de/powerstat/phplib/templateengine/test/TemplateEngineTests.java
src is missing in the path
[INFO] asciidoctor: ERROR: architecture\06_runtime_view.adoc: line 51: include file not found: D:/work/eclipse/java/TemplateEngine/src/site/test/java/de/powerstat/phplib/templateengine/test/TemplateEngineTests.java
site is to much in the path
What you can see is that in both cases the path is wrong!
But the interesting thing is that this happens at two different positions in the output. So I assume that a two phase processing happens.
That results to a bug, because in both phases you are working with different base directories!
In the first pass with:
projectBase/src/site/asciidoc/
(like set in sourceDirectory - the only correct value)In the second pass with:
projectBase/src/site/asciidoc/architecture/
(Not sure if this is the config.adoc path or the one of the 06_runtime_view.adoc - wrong in both cases)Would be nice to fix this bug to allow asciidoc includes within subdirectory structures. Might be an upstream issue for the maven plugin.
The same happens under Windows as well as on MacOS (so I assume also on Linux).
My plugin configuration looks as follows:
Environment information
The text was updated successfully, but these errors were encountered: