-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to convert a Maven plugin config to the Gradle plugin config? #606
Comments
I search the issue. There is an issue that has the same problem: #442 Follow the author of the issue, I found the example project: https://github.com/someok/asciidoctor-gradle-example I written the config as the example:
But run the Gradle task will throw an error:
My project and config: https://github.com/diguage/spring-framework/blob/analysis/truman/build.gradle#L110 |
(disclaimer)Haven't tested myself...(end-disclaimer) |
@abelsromero https://github.com/diguage/spring-framework/blob/analysis/truman/ has a problem. If you open the comment,
and run the command |
But if instead of |
pdfThemes will override any attributes you place w.r.t to this. |
I do not know. Let me try. Thanks. |
I found the cause of the problem. asciidoctorj {
version = '2.5.1'
fatalWarnings ".*"
// outputDir "$buildDir/docs/html"
options doctype: 'book', eruby: 'erubis'
attributes([
icons: 'font',
idprefix: '',
idseparator: '-',
docinfo: 'shared',
revnumber: project.version,
sectanchors: '',
sectnums: '',
'source-highlighter': 'rouge',
'rouge-linenums-mode': 'table',
'rouge-style': 'monokai',
'linkcss': 'true',
toc: 'left',
toclevels: 4,
sectnums: false,
sectnumlevels: 3,
sectanchors: true,
fontsDir: 'cfg/fonts',
graphvizdot: '/usr/local/bin/dot',
stylesdir: 'css',
'spring-version': project.version
])
// It is OK.
pdfThemes {
local 'Source', {
themeDir = file('cfg/theme')
themeName = 'Source'
}
}
modules {
pdf {
version '1.6.0'
}
epub {
version '1.5.1'
}
diagram {
version '2.1.2'
}
}
} But the plugin could not find the font. So the PDF also has a problem: Chinese characters cannot be displayed correctly. Let me try again. Maybe the theme did not been used. How to use my theme? |
asciidoctorj {
version = '2.5.1'
fatalWarnings ".*"
// outputDir "$buildDir/docs/html"
options doctype: 'book', eruby: 'erubis'
attributes([
icons: 'font',
idprefix: '',
idseparator: '-',
docinfo: 'shared',
revnumber: project.version,
sectanchors: '',
sectnums: '',
'source-highlighter': 'rouge',
'rouge-linenums-mode': 'table',
'rouge-style': 'monokai',
'linkcss': 'true',
toc: 'left',
toclevels: 4,
sectnums: false,
sectnumlevels: 3,
sectanchors: true,
fontsDir: 'cfg/fonts',
graphvizdot: '/usr/local/bin/dot',
stylesdir: 'css',
'spring-version': project.version
])
fontsDir file('cfg/fonts') // add the option, it will throw an error.
pdfThemes {
local 'Source', {
themeDir = file('cfg/theme')
themeName = 'Source'
}
}
modules {
pdf {
version '1.6.0'
}
epub {
version '1.5.1'
}
diagram {
version '2.1.2'
}
}
} If I add the ╭─☞ ~/spring-framework git:(analysis) ✗
╰─➜ ./gradlew :truman:clean && ./gradlew :truman:asciidoctorPdf
FAILURE: Build failed with an exception.
* Where:
Build file '/path/to/spring-framework/truman/build.gradle' line: 51
* What went wrong:
A problem occurred evaluating project ':truman'.
> No signature of method: build_2t5dwx4lqxv24c3x6pvoqjatk.asciidoctorj() is applicable for argument types: (build_2t5dwx4lqxv24c3x6pvoqjatk$_run_closure4) values: [build_2t5dwx4lqxv24c3x6pvoqjatk$_run_closure4@695ac417]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
A build scan was not published as you have not authenticated with server 'ge.spring.io'.
|
Reference my Asciidoctor Gradle Plugin Examples https://github.com/life888888/asciidoctor-pdf-cjk-ext-gradle-examples It demo some condition usage examples. |
Please try 4.0.0-alpha.1 and tell me if the problem still exists |
I use 4.0.0-alpha.1, and follow https://github.com/life888888/asciidoctor-pdf-cjk-ext-gradle-examples examples to use 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
} @ysb33r @life888888 Thanks a lot. |
I have a document project written in Chinese. If I want to convert the document to PDF, it must be configurated with the theme with Chinese fonts.
The maven project was configurated well by me: https://github.com/diguage/jdk-source-analysis.
I need to convert the Maven plugin config to the Gradle plugin config in the project: spring-framework/truman at analysis.
The project is special: the parent module configures the task
asciidoctorPdf
, and the submodule must override the task or override the config of the task.The text was updated successfully, but these errors were encountered: