asciidoctor-gradle-examples icon indicating copy to clipboard operation
asciidoctor-gradle-examples copied to clipboard

invalid style for listing block: plantuml

Open smartrics opened this issue 6 years ago • 6 comments

Hello - I am struggling to see what's wrong with my gradle file. It builds correctly but it fails to activate asciidoctor-diagram, causing - as such - the error in subject and no images embedded in the generated html file.

Any hint appreciated...

here follows the output of the build

./gradlew clean asciidoctor

> Task :jrubyPrepare
Successfully installed asciidoctor-diagram-1.5.6
Successfully installed asciidoctor-1.5.6.1
2 gems installed

> Task :asciidoctor
Converting /home/fabrizio/gitlab/ipt-analytics/bayawak/src/docs/test.adoc
asciidoctor: WARNING: test.adoc: line 6: invalid style for listing block: plantuml


BUILD SUCCESSFUL in 16s

This is my adoc file (test.adoc)

= Test

A PlantUML diagram

[plantuml, "diag", png]
----
@startuml

actor User

component Comp1
component Comp2

folder "System"

User --> System
System ..> Comp1
System ..> Comp2

@enduml
----

Here we are!

and finally this is my build.gradle

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'org.asciidoctor:asciidoctorj-diagram:1.5.4.1'
        classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.6'
    }
}

plugins {
    id "org.asciidoctor.convert" version "1.5.6"
    id 'com.github.jruby-gradle.base' version '1.4.0'
}
apply plugin: 'org.asciidoctor.convert'

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    gems 'rubygems:asciidoctor-diagram:1.5.6'
}

asciidoctorj {
    version = '1.5.6'
}

asciidoctor {
    sourceDir = file('src/docs')
    sources {
        include 'test.adoc'
    }
    outputDir = file('build/docs')
    logDocuments = true

    dependsOn jrubyPrepare
    requires = ['asciidoctor-diagram']
    gemPath = jrubyPrepare.outputDir

    attributes   \
            'build-gradle': file('build.gradle'),
            'source-highlighter': 'coderay',
            'imagesdir': 'images',
            'toc': 'left',
            'icons': 'font',
            'allow-uri-read': true,

            backends = ['html5']
}

wrapper {
    gradleVersion = '4.2'
}

smartrics avatar Dec 15 '17 17:12 smartrics

Could this be related to https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/222?

mojavelinux avatar Dec 15 '17 18:12 mojavelinux

I have played around with the file - I notice that sometimes it works (*) straight after the build file is modified in certain parts like the dependencies order. It's as if some cached parts get in the way of loading the extension. I haven't yet found a pattern though on how to make it work consistently

(*) as in, the extension is used and the plantuml diagram correctly generated.

smartrics avatar Dec 18 '17 12:12 smartrics

FWIW the build file here https://github.com/asciidoctor/asciidoctor-gradle-examples/blob/master/asciidoc-diagram-to-html-example/build.gradle

produced

./gradlew asciidoctor
Download https://plugins.gradle.org/m2/org/asciidoctor/asciidoctor-gradle-plugin/1.5.3/asciidoctor-gradle-plugin-1.5.3.pom

> Task :jrubyPrepare
Successfully installed asciidoctor-diagram-1.5.4
1 gem installed

Download https://jcenter.bintray.com/org/asciidoctor/asciidoctorj-groovy-dsl/1.0.0.preview2/asciidoctorj-groovy-dsl-1.0.0.preview2.pom

> Task :asciidoctor
asciidoctor-diagram: ERROR: Failed to generate image: PlantUML image generation failed: Invalid path '/plantuml'

then any subsequent run

./gradlew clean asciidoctor

> Task :jrubyPrepare
Successfully installed asciidoctor-diagram-1.5.4
Successfully installed asciidoctor-1.5.6.1
2 gems installed

> Task :asciidoctor
asciidoctor-diagram: ERROR: Failed to generate image: can't modify frozen 


BUILD SUCCESSFUL in 19s
3 actionable tasks: 3 executed

smartrics avatar Dec 18 '17 13:12 smartrics

gradle -version


Gradle 4.1

Build time: 2017-08-07 14:38:48 UTC Revision: 941559e020f6c357ebb08d5c67acdb858a3defc2

Groovy: 2.4.11 Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015 JVM: 1.8.0_131 (Oracle Corporation 25.131-b11) OS: Linux 3.10.0-514.21.2.el7.x86_64 amd64

smartrics avatar Dec 18 '17 13:12 smartrics

Hit this issue too and for me it is definitely asciidoctor/asciidoctor-gradle-plugin#222 as I can update everything (com.github.jruby-gradle.base and rubygems:asciidoctor-diagram) to latest version except org.asciidoctor.convert which is working with v1.5.3 and failing with v1.5.6-v1.5.8. It looks like there are no v1.5.4-v.1.5.5...

Sticking to v1.5.3 until asciidoctor/asciidoctor-gradle-plugin#222 is open.

I use automatic rebuild on detection of source files changes with gradle -t.

gavenkoa avatar Sep 17 '18 21:09 gavenkoa

Using Maven plugin and have the same Message. [INFO] asciidoctor: DEBUG: sections\00-introduction.adoc: line 18: unknown style for listing block: plantuml [INFO] asciidoctor: DEBUG: sections\50-runtime-view.adoc: line 33: unknown style for listing block: plantuml

Example for a plantuml diagram:

[plantuml, example-diagram, png]
----
class BlockProcessor
class DiagramBlock
class DitaaBlock
class PlantUmlBlock

BlockProcessor <|-- DiagramBlock
DiagramBlock <|-- DitaaBlock
DiagramBlock <|-- PlantUmlBlock
----

cforce avatar Jan 21 '22 07:01 cforce