asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
285 stars 120 forks source link

Fatal Build Success #668

Open micheljung opened 1 year ago

micheljung commented 1 year ago

build.gradle.kts:

plugins {
  id("org.asciidoctor.jvm.convert") version "3.3.2"
}

src/docs/asciidoc/index.adoc:

[[index]]
include::attributes.adoc[]

src/docs/asciidoc/attributes.adoc

:doctype: book

Output:

09:12:55: Executing 'asciidoctor'...

> Task :my-project-docs:asciidoctor
include file not found: C:/foo/my-project/my-project-docs/attributes.adoc :: index.adoc :: C:/foo/my-project/my-project-docs/C:/foo/my-project/my-project-docs/src/docs/asciidoc/index.adoc:2 (uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb:preprocess_include_directive)
M�rz 28, 2023 9:12:58 VORM. uri:classloader:/gems/asciidoctor-2.0.10/lib/asciidoctor/reader.rb preprocess_include_directive
FATAL: index.adoc: line 2: include file not found: C:/foo/my-project/my-project-docs/attributes.adoc

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3s
1 actionable task: 1 executed
09:12:58: Execution finished 'asciidoctor'.

Let's ignore that I don't get yet why it searches attributes.adoc at the wrong place, I would never expect the Gradle build to be successful in case of a FATAL error.

micheljung commented 1 year ago

FYI the error was fixed using:

tasks {
  "asciidoctor"(org.asciidoctor.gradle.jvm.AsciidoctorTask::class) {
    setBaseDir(sourceDir)
  }
}
ascheman commented 3 months ago

I stumbled into this very same error (and it took me some hours to come here, as I expected the problem to be sitting in front of the computer ...).

Unfortunately, the workaround does not work if applied literally, @micheljung. Will try to figure out how this could work.

ascheman commented 3 months ago

By chance I found that you could add baseDirFollowsSourceFile() to the asciidoctor task definition to resolve this:

...
asciidoctor {
    ...
    baseDirFollowsSourceFile()
    ...
}
...

Please provide at least some documentation about it, @mojavelinux. Thanks!

mojavelinux commented 3 months ago

Don't tell me to add documentation. If you want documentation added, you can step up and contribute it. This project relies on community contributions. It's not my job to handle everything.