I need to generate a PDF version of the docbook.xml documentation (5.0) when building the java project using gradle (build.gradle file).
在使用gradle(build.gradle文件)构建java项目时,我需要生成docbook.xml文档(5.0)的PDF版本。
If someone could show an example of a script that will work on any platform (Mac OS X, Windows, Linux) that would be very helpful.
如果有人可以展示一个可以在任何平台(Mac OS X,Windows,Linux)上运行的脚本示例,那将非常有用。
1 个解决方案
#1
5
Ok, so finally I found the solution. In order to generate a PDF, you have to provide the following files :
好的,最后我找到了解决方案。要生成PDF,您必须提供以下文件:
- The docbook file (.XML)
- An XSL stylesheet file (.XSL)
- The docbook.gradle file that you can grab from here: https://github.com/SpringSource/spring-build-gradle/blob/master/docbook.gradle
- The build.gradle file
docbook文件(.XML)
XSL样式表文件(.XSL)
您可以从此处获取的docbook.gradle文件:https://github.com/SpringSource/spring-build-gradle/blob/master/docbook.gradle
build.gradle文件
You have to add after to build.gradle the line
你必须在build.gradle之后添加
apply from: "docbook.gradle"
after
apply plugin: "java"
Then, append to the end of build.gradle this:
然后,追加到build.gradle的末尾:
docbookPdf {
sourceFileName = "docbook.xml"
stylesheet = file("doc/docbook-style.xsl")
sourceDirectory = file( "doc" )
docsDir = new File(project.getBuildDir(), "docs");
}
Here, we've put the docbook.xml and docbook-style.xsl in rootDirectory/doc, and we put the generated PDF in rootDirectory/docs (/pdf).
在这里,我们将docbook.xml和docbook-style.xsl放在rootDirectory / doc中,然后将生成的PDF放在rootDirectory / docs(/ pdf)中。
Here is an example of a docbook stylesheet that you can use: http://cl.ly/2n1p3o0r1L3Z1d2U4345
以下是您可以使用的docbook样式表示例:http://cl.ly/2n1p3o0r1L3Z1d2U4345
To generate the PDF, from the terminal, go to the directory where the file build.gradle is and execute
要从终端生成PDF,请转到文件build.gradle所在的目录并执行
gradle docbookPdf
if you named the task 'docbookPdf'.
如果您将任务命名为“docbookPdf”。
That's it. It should work on any platform.
而已。它应该适用于任何平台。
#1
5
Ok, so finally I found the solution. In order to generate a PDF, you have to provide the following files :
好的,最后我找到了解决方案。要生成PDF,您必须提供以下文件:
- The docbook file (.XML)
- An XSL stylesheet file (.XSL)
- The docbook.gradle file that you can grab from here: https://github.com/SpringSource/spring-build-gradle/blob/master/docbook.gradle
- The build.gradle file
docbook文件(.XML)
XSL样式表文件(.XSL)
您可以从此处获取的docbook.gradle文件:https://github.com/SpringSource/spring-build-gradle/blob/master/docbook.gradle
build.gradle文件
You have to add after to build.gradle the line
你必须在build.gradle之后添加
apply from: "docbook.gradle"
after
apply plugin: "java"
Then, append to the end of build.gradle this:
然后,追加到build.gradle的末尾:
docbookPdf {
sourceFileName = "docbook.xml"
stylesheet = file("doc/docbook-style.xsl")
sourceDirectory = file( "doc" )
docsDir = new File(project.getBuildDir(), "docs");
}
Here, we've put the docbook.xml and docbook-style.xsl in rootDirectory/doc, and we put the generated PDF in rootDirectory/docs (/pdf).
在这里,我们将docbook.xml和docbook-style.xsl放在rootDirectory / doc中,然后将生成的PDF放在rootDirectory / docs(/ pdf)中。
Here is an example of a docbook stylesheet that you can use: http://cl.ly/2n1p3o0r1L3Z1d2U4345
以下是您可以使用的docbook样式表示例:http://cl.ly/2n1p3o0r1L3Z1d2U4345
To generate the PDF, from the terminal, go to the directory where the file build.gradle is and execute
要从终端生成PDF,请转到文件build.gradle所在的目录并执行
gradle docbookPdf
if you named the task 'docbookPdf'.
如果您将任务命名为“docbookPdf”。
That's it. It should work on any platform.
而已。它应该适用于任何平台。