Не удается обновить asciidoctor из-за outputOptions - PullRequest
0 голосов
/ 27 января 2020

В настоящее время я использую плагин Asciidoctor Gradle для создания документации для моего проекта. Это добавлено следующим образом:

plugins {
    ...
    id "org.asciidoctor.convert" version "2.4.0"
}
apply plugin: 'org.asciidoctor.convert
...
dependencies {
    ...
    asciidoctor "org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.15"
    asciidoctor "org.asciidoctor:asciidoctorj-diagram:1.5.4.1"
}
...
asciidoctorj {
    version = '1.5.8'
    noDefaultRepositories = true
}
asciidoctor {
    sourceDir file('src/docs/asciidoc')
    backends = ['html5', 'pdf']

    sources {
        include 'documentation.adoc'
    }

    outputDir = file('build/docs')

    attributes([
        'pdf-stylesdir': "pdfTheme",
        'pdf-style': 'custom',
        'source-highlighter': 'coderay',
        'imagesdir': 'images',
        'toc': 'left',
        'icons': 'font',
        'javaVersion': System.getProperty("java.version"),
        'currentDate': new Date().format("d. MMM yyyy"),
        'allow-uri-read': true
    ])

    // good to see what the build is doing...
    logDocuments = true

    requires = ['asciidoctor-diagram']
}

task asciidocToHTML (
        type: AsciidoctorTask,
        group: 'Document Generation',
        description: 'use html5 as asciidoc backend') {

    attributes([
        'plantUMLDir': ''
    ])

    backends = ['html5']
    mustRunAfter "openApiToAsciidoc"
}

task asciidocToPDF (
        type: AsciidoctorTask,
        group: 'Document Generation',
        description: 'use pdf as asciidoc backend') {

    attributes([
        'plantUMLDir': file("build/images/plantUML/").path
    ])

    backends = ['pdf']
    mustRunAfter "openApiToAsciidoc"
}

task openApiToAsciidoc (
        type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask,
        group: 'Document Generation',
        description: 'generate AsciiDoc from OpenApi specification') {

    generatorName = "asciidoc"
    inputSpec = "$rootDir/specs/src/main/resources/openapi.json".toString()
    outputDir = "$buildDir/generated".toString()

    configOptions = [
            headerAttributes: "false"
    ]

}

Теперь, каждый раз, когда я запускаю сборку Gradle, предлагается обновить эту версию из-за устаревших функций:

You are using one or more deprecated Asciidoctor Gradle plugin features.
These will be removed in 3.0 of these plugins.
To help you migrate we have compiled some tips for you based upon your current usage.
- Task: asciidoctor:
  - You have used 'backends'. When upgrading you will need to: Use outputOptions.setbackends
  - You have used 'requires'. When upgrading you will need to: When upgrading GEMs, 'requires' will need to be set via the asciidoctorj project and task docExtensions. Use  setGemPaths method in extension(s) to set GEM paths.
- org.asciidoctor.convert:
  - 'org.asciidoctor.convert' is deprecated. When you have time please switch over to 'org.asciidoctor.jvm.convert'.
  - jcenter() is no longer added by default. If you relied on this behaviour in the past, please add jcenter() to the repositories block.

Однако я не могу обновите его, потому что при попытке использовать

asciidoctor{ 
...
  outputOptions { 
    backends = ['html5'] 
  }
}

я получил следующую ошибку:

Не удалось найти метод outputOptions () для аргументов [build_bwu06l6l07d4ekv1kid7x1qa4$_run_closure16$_closure39@7254a9f3] в задаче ': asciidocToPDF типа org.asciidoctor.gradle.AsciidoctorTask.

Кроме того, при использовании org.asciidoctor.gradle.jvm.AsciidoctorTask возникает следующая проблема:

Невозможно привести объект 'org.asciidoctor.gradle.compat. AsciidoctorExtension_Decorated@17a75298' с классом 'org.asciidoctor.gradle.compat.AsciidoctorExtension_Decorated' в класс 'org.ysb33r.grolifant.api.AbstractCombinedProjectTaskExtension'

...