Closed bjet007 closed 3 years ago
In order to keep compatibility for my asciidoc between gitlab and asciidoctor, I'm trying to generate a ditaa diagram through the plantuml endpoint.
Could you please elaborate? You cannot use the /ditaa
endpoint?
It seem that there is a conflicting libraries within the server. It seem that plantuml package ditaa within it's dependencies and kroki import dita in 2 other dependencies, i guess that is the issue.
Yes, I think you're right. For reference, the error is:
Not sure what is the best fix here.
Using ditaa through PlantUML has a few limitations, for instance it only supports PNG format.
Since we have a full-featured service for ditaa, I think the best solution is to use the /ditaa
endpoint.
I guess we could check if the diagram starts with @startditaa
and if that's the case delegate the work to the ditaa service.
Not sure if we should also support ditaa options:
-E
ou --no-separation
(to suppress separators)-S
ou --no-shadows
(to suppress shadows)scale=XYZ
Or if we should support the ditaa
keyword.
To give a bit more context to my current situation.
I need to write technical document that will be use by developer, product owner and few other key people. I'm testing a workflow with gitlab so that we can include this document in our workflow that is mainly driven by developper. The document is written in asciidoc and contains diagram and that are committed to gitlab like any other piece of code that we have. My intent is to also publish these document so that some key people in can have access to it without login into gitlab. The main reader and reviewer will be developer that have access to our gitlab, so diagram need to be rendered in gitlab.
Gitlab only support a plantuml server and so far I've used asciidoctor through antora to publish the html version. The asciidoctor-plantuml extension seem to be deprecated in favor of the asciidoctor-kroki extension. So i would like to keep compatibility by only using plantuml diagram for now. Using the ditaa enpoint only work with asciidoctor and It won't render diagram in gitlab.
Since this is a test and I have only one ditaa for now, that is more or less static, I will find another method to publish that diagram.
Looking quickly at the error, I tough that it would be better to report the issue. It seem to be related to multiple versions of the same library loaded in the same project and you could have the same type of issue in the ditaa endpoint. It's just a matter of which class is loaded first in the jvm and those errors lead to bigger problem sometime.
Gitlab only support a plantuml server
Actually, GitLab now supports Kroki: https://docs.gitlab.com/ee/administration/integration/kroki.html Once Kroki integration is enabled (and configured), the following example should render a ditaa diagram directly in GitLab.
[ditaa]
....
+--------+ +-------+ +-------+
| +---+ ditaa +--> | |
| Text | +-------+ |diagram|
|Document| |!magic!| | |
| {d}| | | | |
+---+----+ +-------+ +-------+
: ^
| Lots of work |
+-------------------------+
....
Please note that I also plan to add support for the following syntax:
ditaa::diagram.txt[]
The above example will read the file diagram.txt
from the GitLab repository and render the diagram! š¤Æ
Looking quickly at the error, I tough that it would be better to report the issue. It seem to be related to multiple versions of the same library loaded in the same project and you could have the same type of issue in the ditaa endpoint.
You did the right thing, thanks!
It's just a matter of which class is loaded first in the jvm and those errors lead to bigger problem sometime.
To clarify, we should definitely fix this issue but I have not yet decided what would be the best approach š
Thanks, I was not aware of the kroki support in gitlab.
For the approach, I did use the Maven Shade Plugin with great success in the past. Might be a good solution for you since you already leverage maven to build the project.
I have the same problem and gitlab only support Kroki for on premise so not a solution to me. (which is a shame!)
(I'd be fine with just png's working though)
For the record (my tests)
This works in gitlab (web)
[plantuml, adiag, png]
----
ditaa()
+------+
| c {c}|
+------+
----
And on plantuml.com
@startuml
ditaa()
+------+
| c {c}|
+------+
@enduml
http://www.plantuml.com/plantuml/png/SoWkIImgAStDuKh9B4bCrD3aqjO50ssk6eLaXUhasXg4Y4DgNWfGAG00
I'm using Kroki server, and VSCode asciidoc to author the gitlab docs
[plantuml, adiag, png]
----
ditaa()
+------+
| c {c}|
+------+
----
Gives this url in Kroki docker logs
/plantuml/png/eNpLySxJTNTQ5NLWBQNtrhqFZIXq5NoahAgAoFoIOw==
And
Thanks!
Thanks @lcm337 for your input.
This is the same issue. I would recommend using the /ditaa
endpoint which uses an optimized version of Ditaa (built from this fork: https://github.com/pepijnve/ditaa).
For the approach, I did use the Maven Shade Plugin with great success in the past. Might be a good solution for you since you already leverage maven to build the project.
I will suggest that to @pepijnve
Thanks Mogztter - I have no control over the endpoint because it happens on the Gitlab server.
Or more accurately I can use [ditaa] for the endpoint when authoring to use the /ditaa endpoint.
But saving that to gitlab will fail to render as ditaa and Kroki are not available.
Whereas gitlab will render using [plantuml] and its embedded ditaa.
@Mogztter I guess the best we can do here is change the package name of the forked version to avoid conflicts with PlantUML's embedded version of Ditaa. Is that ok as a solution for you?
@pepijnve yes that sounds good šš»
Fixed in #645
@bjet007 Version 0.12.0 has been deployed to https://kroki.io
@Mogztter, thanks.
Problem
In order to keep compatibility for my asciidoc between gitlab and asciidoctor, I'm trying to generate a ditaa diagram through the plantuml endpoint. sing the sample provided by the plantuml documentation ( https://plantuml.com/ditaa), i expect to receive a valid graphic with https://kroki.io//plantuml enpoint.
Sample Used:
Url Called:
https://kroki.io//plantuml/png/eNpLySxJTOTi0taFAm0FBQVtJDaCw1WjAAXaYLkUkE4Q204BJlMDUhOSWlGiABZCMacmJTMxvSgxF6jGJT-5NDc1rwSkpkYxNzE9M1kRbASKOUBQnVJbgyyMqgbsDAJuBvGsFHCBOC5kE33yS4oV8tMUyvOLsmF2IJuGCbS5AJYYQVU=
Result
It seem that there is a conflicting libraries within the server. It seem that plantuml package ditaa within it's dependencies and kroki import dita in 2 other dependencies, i guess that is the issue. Not sure what is the best fix here.