Skip to content

Operation block macro fails with 2.2 Asciidoctor Gradle Plugins does to missing gradle-projectdir attribute #624

Closed
@jnizet

Description

@jnizet

This is a followup to #403.

Using spring-restdocs 2.0.4.BUILD-SNAPSHOT, with the org.asciidoctor.convert:2.2.0 plugin or the org.asciidoctor.jvm.convert:2.2.0 plugin, the asciidoctor task fails wil the following exception:

> Task :backend:asciidoctor
Exception in thread "main" org.asciidoctor.gradle.remote.AsciidoctorRemoteExecutionException: Error running Asciidoctor whilst attempting to process /Users/jb/projects/amies-server/backend/src/main/asciidoc/index.adoc using backend html5
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_convertFiles_closure4.doCall(AsciidoctorJavaExec.groovy:87)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        at groovy.lang.Closure.call(Closure.java:411)
        at groovy.lang.Closure.call(Closure.java:427)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2296)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2281)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2334)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.convertFiles(AsciidoctorJavaExec.groovy:78)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.access$1(AsciidoctorJavaExec.groovy)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_run_closure3.doCall(AsciidoctorJavaExec.groovy:70)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_run_closure3.call(AsciidoctorJavaExec.groovy)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2296)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2281)
        at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2322)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.run(AsciidoctorJavaExec.groovy:65)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec.main(AsciidoctorJavaExec.groovy:47)
Caused by: java.lang.IllegalStateException: asciidoctor: FAILED: /Users/jb/projects/amies-server/backend/src/main/asciidoc/index.adoc: Failed to load AsciiDoc document
        at org.springframework.restdocs.asciidoctor.SnippetsDirectoryResolver.getRequiredAttribute(SnippetsDirectoryResolver.java:78)
        at org.springframework.restdocs.asciidoctor.SnippetsDirectoryResolver.getRequiredAttribute(SnippetsDirectoryResolver.java:68)
        at org.springframework.restdocs.asciidoctor.SnippetsDirectoryResolver.lambda$getGradleSnippetsDirectory$0(SnippetsDirectoryResolver.java:63)
        at org.springframework.restdocs.asciidoctor.SnippetsDirectoryResolver.getRequiredAttribute(SnippetsDirectoryResolver.java:76)
        at org.springframework.restdocs.asciidoctor.SnippetsDirectoryResolver.getGradleSnippetsDirectory(SnippetsDirectoryResolver.java:62)
        at org.springframework.restdocs.asciidoctor.SnippetsDirectoryResolver.getSnippetsDirectory(SnippetsDirectoryResolver.java:39)
        at org.springframework.restdocs.asciidoctor.DefaultAttributesAsciidoctorJ16Preprocessor.process(DefaultAttributesAsciidoctorJ16Preprocessor.java:36)
        at org.asciidoctor.extension.processorproxies.PreprocessorProxy.process(PreprocessorProxy.java:95)
        at org.asciidoctor.extension.processorproxies.PreprocessorProxy$INVOKER$i$2$0$process.call(PreprocessorProxy$INVOKER$i$2$0$process.gen)
        at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodTwoOrN.call(JavaMethod.java:1008)
        at org.jruby.RubyMethod.call(RubyMethod.java:121)
        at org.jruby.RubyMethod$INVOKER$i$call.call(RubyMethod$INVOKER$i$call.gen)
        at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrTwoOrNBlock.call(JavaMethod.java:353)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:201)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:326)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:128)
        at org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:151)
        at org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:187)
        at org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
        at org.jruby.runtime.Block.yield(Block.java:165)
        at org.jruby.RubyArray.each(RubyArray.java:1792)
        at org.jruby.RubyArray$INVOKER$i$0$0$each.call(RubyArray$INVOKER$i$0$0$each.gen)
        at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroBlock.call(JavaMethod.java:537)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:82)
        at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:91)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:544)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:80)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:138)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:125)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:191)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:325)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:141)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:346)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:92)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:204)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:191)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:207)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:367)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:203)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:326)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:303)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:84)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:547)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
        at org.jruby.RubyMethod.call(RubyMethod.java:129)
        at org.jruby.RubyMethod$INVOKER$i$call.call(RubyMethod$INVOKER$i$call.gen)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:303)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:84)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:547)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:82)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:547)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:82)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:547)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:82)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:547)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:303)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:84)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:547)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:303)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:84)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:547)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:80)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:138)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:125)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:191)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:325)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:141)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:346)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:92)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:204)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:191)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:207)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:367)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:203)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:326)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.ir.interpreter.InterpreterEngine.interpret(InterpreterEngine.java:92)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:204)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:191)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:207)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:367)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:203)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:326)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.ir.interpreter.Interpreter.INTERPRET_BLOCK(Interpreter.java:128)
        at org.jruby.runtime.MixedModeIRBlockBody.commonYieldPath(MixedModeIRBlockBody.java:151)
        at org.jruby.runtime.IRBlockBody.doYield(IRBlockBody.java:187)
        at org.jruby.runtime.BlockBody.yield(BlockBody.java:116)
        at org.jruby.runtime.Block.yield(Block.java:165)
        at org.jruby.RubyIO.ensureYieldClose(RubyIO.java:1163)
        at org.jruby.RubyIO.open(RubyIO.java:1157)
        at org.jruby.RubyIO$INVOKER$s$0$0$open.call(RubyIO$INVOKER$s$0$0$open.gen)
        at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:303)
        at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:84)
        at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:91)
        at org.jruby.ir.instructions.CallBase.interpret(CallBase.java:544)
        at org.jruby.ir.interpreter.InterpreterEngine.processCall(InterpreterEngine.java:362)
        at org.jruby.ir.interpreter.StartupInterpreterEngine.interpret(StartupInterpreterEngine.java:72)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.INTERPRET_METHOD(MixedModeIRMethod.java:105)
        at org.jruby.internal.runtime.methods.MixedModeIRMethod.call(MixedModeIRMethod.java:92)
        at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:173)
        at org.jruby.RubyClass.finvoke(RubyClass.java:888)
        at org.jruby.runtime.Helpers.invoke(Helpers.java:442)
        at org.jruby.RubyBasicObject.callMethod(RubyBasicObject.java:374)
        at org.asciidoctor.internal.JRubyAsciidoctor.convertFile(JRubyAsciidoctor.java:488)
        at org.asciidoctor.internal.JRubyAsciidoctor.convertFile(JRubyAsciidoctor.java:469)
        at org.asciidoctor.gradle.remote.AsciidoctorJavaExec$_convertFiles_closure4.doCall(AsciidoctorJavaExec.groovy:83)
        ... 22 more
Caused by: java.lang.IllegalStateException: asciidoctor: FAILED: <stdin>: Failed to load AsciiDoc document
        ... 162 more
Caused by: java.lang.IllegalStateException: projectdir attribute not found
        ... 162 more

This exception doesn't happen with the versions 1.5.9.2 and 1.6.0 of the org.asciidoctor.convert plugin.

I checked that I don't use the projectdir attribute anywhere in my index.adoc document and in the generated snippets.
I also checked that, if I don't use the spring-restdocs extension (to avoid the above exception), and add gradle-projectdir = {gradle-projectdir} to my index.adoc file, I get the expected value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions