5

I don't know any Ruby but I do like asciidoctor (and the gradle plugin). Is there a simple way to get the plugin to generate plantuml diagrams?

I looked at the basic asciidoctor-diagrams functionality which seems specific to using the native/ruby asciidoctor extension (which I don't have and would rather not install since I like using the gradle plugin).

The nicely done asciidoctor-gradle-plugin documentation page shows that it accepts a requires option for Ruby modules but having no grounding in Ruby whatsoever, I'm not sure if that's what I need or not.

I tried the path of least resistant, i.e.:

asciidoctor {
    logDocuments = true
    separateOutputDirs = false
    sourceDir = file("src")
    outputDir = file("$buildDir/html")
    backends = [ 'html5' ]
    requires "asciidoctor-diagram"
}

Against my basic plantuml test:

.The PlantUML block extension class
[plantuml, sample-plantuml-diagram, alt="Class diagram", width=135, height=118]
----
class BlockProcessor
class PlantUmlBlock
BlockProcessor <|-- PlantUmlBlock
----

But got:

* What went wrong:
Execution failed for task ':asciidoctor'.
> (LoadError) no such file to load -- asciidoctor-diagram

during the configuration phase.

How can I configure asciidoctor-gradle-plugin to handle plantuml?

AndyJ
  • 1,204
  • 3
  • 14
  • 28

2 Answers2

1

mrhaki to the rescue. I don't want to totally rip-off his post, but in case that link ever goes bad, there are numerous other dependencies that need to be met in the gradle file the first that I didn't have was com.github.jruby-gradle:jruby-gradle-plugin:0.1.5 then he applies two plugins including com.github.jruby-gradle.base and has a dependency on ruby gems (rubygems:asciidoctor-diagram:1.2.0). I think his blog site is pretty reliable so I won't go into the details.

AndyJ
  • 1,204
  • 3
  • 14
  • 28
  • FYI. . . I thought since mrhaki had laid it all out I'd be fine, but apparently I jumped the gun since I am still getting the loadfile error. Seems I lost the battle on this one. – AndyJ Mar 11 '15 at 17:55
  • 1
    Through time `asciidoctor-gradle-plugin` got a nice example repository https://github.com/asciidoctor/asciidoctor-gradle-examples/ which might be helpful for anybody popping in here – Jakub Marchwicki Aug 30 '15 at 19:59
  • the Link to mrHaki helped me, to get it working. I had to add `:imagesdir: images` to my asciidoc document. – Tobias Hochgürtel Jun 30 '17 at 13:17
0

I had the same problem and the source was that I was missing the line

gemPath = jrubyPrepare.outputDir

which seems to communicate the path where gems are stored to the asciidoctor task

Or at least this makes the no such file to load problem go away, I then got an error about not finding graphviz, which I could fix by installing graphviz on my machine.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348