pep*_*psi 7 spring-boot asciidoctor spring-restdocs
我正在采用 Spring Rest Docs,并且测试成功创建了 *.adoc 文件。
我在 src/docs/asciidoc 目录中创建了 api-guide.doc 文件来创建 html,但是当我将 asciidoc 作为 gradle 任务运行时,它会产生以下错误。
Some problems were found with the configuration of task ':asciidoctor' (type 'AsciidoctorTask').
- In plugin 'org.asciidoctor.convert' type 'org.asciidoctor.gradle.AsciidoctorTask' method 'asGemPath()' should not be annotated with: @Optional, @InputDirectory.
Run Code Online (Sandbox Code Playgroud)
我用spring初始化器初始化了项目,所以我相信gradle依赖没有问题。
plugins {
id 'org.springframework.boot' version '2.5.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.asciidoctor.convert' version '1.5.8'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
ext {
set('snippetsDir', file("build/generated-snippets"))
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
}
test {
outputs.dir snippetsDir
useJUnitPlatform()
}
asciidoctor {
inputs.dir snippetsDir
dependsOn test
}
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?
需要对 https://start.spring.io 进行更新,以便生成与 Gradle 7 兼容的配置。
id 'org.asciidoctor.convert' version '1.5.8'您可以通过降级到 Gradle 6.x 来避免该问题,也可以通过替换为来切换到更新版本的 Asciidoctor Gradle 插件id 'org.asciidoctor.jvm.convert' version '3.3.2'
| 归档时间: |
|
| 查看次数: |
2331 次 |
| 最近记录: |