Open mlasevich opened 1 year ago
This is also an issue with: gradle: 8.4 plugin: 3.3.2 Java: 21 @ysb33r @aalmiray you seem to be the biggest contributors/maintainers, are you going to come back to this plugin? Are you just busy, have too many other projects, the required changes require more time and thought than you have time for, are burnt out, or something else?
I ask because without this plugin Spring Restdocs is not a viable way to document APIs. There are other alternatives, but none look as good or force you to write and maintain tests that generate snippets of asciidoctor. Also, a lot of Github projects use this for documentation which looks a lot nicer than the Githubs markdown.
I met a similar problem.
The project and the Gradle config file: https://github.com/diguage/spring-framework/blob/analysis/truman/truman.gradle
plugins {
id 'war'
id 'me.champeau.jmh'
id 'org.asciidoctor.jvm.convert' version '4.0.2'
id 'org.asciidoctor.jvm.pdf' version '4.0.2'
id 'org.asciidoctor.jvm.gems' version '4.0.2'
}
configurations {
asciidoctorExt
asciidocExtensions
}
dependencies {
// asciidoctorGems "rubygems:rouge:4.1.0"
asciidoctorGems "rubygems:rouge:3.30.0"
asciidoctorGems "rubygems:asciidoctor-multipage:0.0.19"
asciidoctorGems "rubygems:asciidoctor-comment-links:0.0.1"
implementation(project(":spring-beans"))
implementation(project(":spring-context"))
implementation(project(":spring-jdbc"))
implementation(project(":spring-webmvc"))
implementation(project(":spring-test"))
implementation("jakarta.annotation:jakarta.annotation-api")
implementation("com.fasterxml.jackson.core:jackson-databind")
implementation("org.aspectj:aspectjweaver")
implementation('org.projectlombok:lombok:1.18.30')
annotationProcessor 'org.projectlombok:lombok:1.18.30'
implementation 'com.zaxxer:HikariCP:5.1.0'
implementation 'com.mysql:mysql-connector-j:8.2.0'
// implementation 'mysql:mysql-connector-java:5.1.49'
implementation 'org.mybatis:mybatis:3.5.15'
implementation 'org.mybatis:mybatis-spring:3.0.3'
providedCompile("jakarta.servlet:jakarta.servlet-api:6.0.0")
implementation('io.undertow:undertow-servlet:2.3.10.Final')
implementation('io.undertow:undertow-websockets-jsr:2.3.10.Final')
jmh 'org.openjdk.jmh:jmh-core:1.37'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
jmh 'net.sf.jopt-simple:jopt-simple:5.0.4'
implementation("org.slf4j:slf4j-api")
implementation("org.apache.logging.log4j:log4j-slf4j-impl")
implementation("org.apache.logging.log4j:log4j-1.2-api")
implementation("org.apache.logging.log4j:log4j-jcl")
implementation("org.apache.logging.log4j:log4j-jul")
implementation("org.apache.logging.log4j:log4j-core")
implementation("org.junit.platform:junit-platform-launcher")
implementation("org.junit.jupiter:junit-jupiter-engine")
implementation("org.mockito:mockito-core")
implementation("org.mockito:mockito-junit-jupiter")
implementation("org.assertj:assertj-core")
implementation platform("org.apache.dubbo:dubbo-bom:3.2.10")
implementation("org.apache.dubbo:dubbo-registry-multicast")
implementation("org.apache.dubbo:dubbo-registry-zookeeper")
implementation("org.apache.dubbo:dubbo-configcenter-zookeeper")
implementation("org.apache.dubbo:dubbo-metadata-report-zookeeper")
implementation("org.apache.dubbo:dubbo-rpc-dubbo")
implementation("org.apache.dubbo:dubbo-config-spring")
implementation("org.apache.dubbo:dubbo-remoting-netty4")
implementation("org.apache.dubbo:dubbo-serialization-hessian2")
implementation 'javax.activation:activation:1.1.1'
implementation 'com.sun.activation:jakarta.activation:2.0.1'
implementation 'io.ratpack:ratpack-core:1.9.0'
}
test {
// make sure the classes dir is used on the test classpath (required by ResourceTests)
// When test fixtures are involved, the JAR is used by default
classpath = sourceSets.main.output.classesDirs + classpath - files(jar.archiveFile)
}
asciidoctor {
// 加载必要的 Gem
dependsOn asciidoctorGemsPrepare
configurations 'asciidoctorExt'
configurations 'asciidoctorExtensions'
baseDirFollowsSourceDir()
asciidoctorj {
// TODO 不生效
// https://github.com/owenh000/asciidoctor-multipage
requires "asciidoctor-multipage"
attributes require: "asciidoctor-multipage",
backend: "multipage_html5"
}
sources {
include 'index.adoc'
}
outputDir "${project.buildDir}/docs/html5"
forkOptions {
jvmArgs += ["--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED"]
}
logDocuments = true
}
asciidoctorPdf {
baseDirFollowsSourceDir()
asciidoctorj {
attributes "pdf-fontsdir": "${project.projectDir}/cfg/fonts;GEM_FONTS_DIR;",
"pdf-themesdir": "${project.projectDir}/cfg/theme",
"pdf-theme": "Source"
}
sources {
include 'index.adoc'
}
outputDir "${project.buildDir}/docs/pdf"
forkOptions {
jvmArgs += ["--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED"]
}
logDocuments = true
}
asciidoctorj {
def sourceAttr = 'linenums,indent=0,subs="attributes,verbatim"'
version = '2.5.10'
jrubyVersion = '9.3.10.0'
fatalWarnings ".*"
options doctype: 'book', eruby: 'erubis'
attributes([
author: 'D瓜哥',
email: 'https://www.diguage.com',
revnumber: project.version,
icons: 'font',
idprefix: '',
idseparator: '-',
docinfo: 'shared',
sectanchors: '',
sectnums: '',
'source-highlighter': 'rouge',
'rouge-style': 'github', // molokai, monokai, github, gruvbox
'linkcss': 'true',
toc: 'left',
toclevels: 4,
sectnums: false,
sectnumlevels: 4,
sectanchors: true,
fontsDir: 'cfg/fonts',
graphvizdot: '/usr/local/bin/dot',
stylesdir: 'css',
homepage: 'https://www.diguage.com',
plantumlconfig: "${project.projectDir}/cfg/plantuml.cfg",
"scripts": "cjk",
'spring-version' : project.version,
'source_attr' : sourceAttr,
'java_src_attr' : "source%nowrap,java,${sourceAttr}",
'xml_src_attr' : "source%nowrap,xml,${sourceAttr}",
'image_attr' : 'align="center",width=98%',
'diagram_attr' : 'format=svg,align="center",width=98%',
// 'rootDir' : project.rootDir, // = /path/to/spring-framework
// 'projectDir': project.projectDir, // = /path/to/spring-framework/truman
// 'buildDir' : project.buildDir, // = /path/to/spring-framework/truman/build
'truman_src_dir' : "${project.projectDir}/src/main/java/com/diguage/truman",
'truman_resource_dir': "${project.projectDir}/src/main/resources/com/diguage/truman",
'aop_src_dir' : "${project.rootDir}/spring-aop/src/main/java/org/springframework/aop",
'beans_src_dir' : "${project.rootDir}/spring-beans/src/main/java/org/springframework/beans",
'context_src_dir' : "${project.rootDir}/spring-context/src/main/java/org/springframework",
'core_src_dir' : "${project.rootDir}/spring-core/src/main/java/org/springframework",
'jdbc_src_dir' : "${project.rootDir}/spring-jdbc/src/main/java/org/springframework/jdbc",
'tx_src_dir' : "${project.rootDir}/spring-tx/src/main/java/org/springframework"
])
// attribute 'docinfo1', ''
modules {
pdf {
version '2.3.7'
}
epub {
version '1.5.1'
}
diagram {
version '2.2.9'
}
}
}
repositories {
ruby.gems()
mavenLocal()
mavenCentral()
}
$ java -version
openjdk version "21.0.2" 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode)
$ ./gradlew -version
------------------------------------------------------------
Gradle 8.6
------------------------------------------------------------
Build time: 2024-02-02 16:47:16 UTC
Revision: d55c486870a0dc6f6278f53d21381396d0741c6e
Kotlin: 1.9.20
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 21.0.2 (Eclipse Adoptium 21.0.2+13-LTS)
OS: Mac OS X 12.6 x86_64
$ ./gradlew clean && ./gradlew :truman:asciidoctor --no-build-cache --stacktrace
> Configure project :integration-tests
Directory '/Users/diguage/.sdkman/candidates/java/17.0.5-amzn' (Maven Toolchains) used for java installations does not exist
Directory '/Users/diguage/.sdkman/candidates/java/11.0.17-amzn' (Maven Toolchains) used for java installations does not exist
Directory '/Users/diguage/.sdkman/candidates/java/8.0.352-amzn' (Maven Toolchains) used for java installations does not exist
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/Users/diguage/path/to/spring-framework/truman/truman.gradle' line: 193 // ruby.gems()
* What went wrong:
A problem occurred evaluating project ':truman'.
> Could not initialize class ratpack.file.internal.ActivationBackedMimeTypes
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org.
==============================================================================
2: Task failed with an exception.
-----------
* Where:
Build file '/Users/diguage/path/to/spring-framework/truman/truman.gradle' line: 193 // ruby.gems()
* What went wrong:
A problem occurred evaluating project ':truman'.
> Could not initialize class ratpack.file.internal.ActivationBackedMimeTypes
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org.
==============================================================================
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.6/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 2s
4 actionable tasks: 4 up-to-date
Can you provide the actual stack trace?
Can you provide the actual stack trace?
I tried many times and still couldn't get the information.
@ysb33r You can clone the repo and try it:
$ git clone -b asciidoctor-gradle-plugin git@github.com:diguage/spring-framework.git
$ cd spring-framework
$ ./gradlew clean && ./gradlew :truman:asciidoctor
Thanks a lot.
Tried gradle 7.5.1, 8.2 and 8.3 plugin: 3.3.2
Works under JDK 8 and 11, under 17 I get this error: