[英]XSD documentation as a part of build process
I've got multiple XSD files describing a schema. 我有多个描述架构的XSD文件。 I'd like to generate a human readable documentation as a result of a build process.
作为构建过程的结果,我想生成一个人类可读的文档。
The XSD is maintained and review within repository (gitflow) and commiting the documentation makes the repository cluttered. XSD在存储库(gitflow)中进行维护和审查,并且提交文档会使存储库变得混乱。 I'd like to generate human readable HTML during the build process (maven / gradle / ant build or simple CLI interface)
我想在构建过程中生成人类可读的HTML(maven / gradle / ant build或简单的CLI界面)
Found this post How to convert xsd to human readable documentation? 发现此帖子如何将xsd转换为人类可读文档? and DocFlex/XML Maven plugin seems interesting but I can't believe that's the only one.
和DocFlex / XML Maven插件看起来很有趣,但我无法相信这是唯一的插件 。
Any helpful tips on that? 对此有任何有用的提示?
I ended up with Oxygen Editor schemaDocumentation.sh
script wrapped in gradle build. 我最终得到了包含在gradle构建中的Oxygen Editor
schemaDocumentation.sh
脚本。
My build.gradle
so far looks like this - and I suspect it's still work in progress. 到目前为止,我的
build.gradle
看起来像这样 - 我怀疑它仍在进行中。 It does it's job, HTMLs get generated to build/generated-html
folder, but it requires oxygen to be installed in OXYGEN_HOME
bath (with license included). 这样做是有效的,HTML会生成
build/generated-html
文件夹,但它需要在OXYGEN_HOME
浴缸中安装氧气(包含许可证)。 I may fix it someday in the future 我可能会在将来的某一天修复它
apply plugin: 'java'
version = "1.0-SNAPSHOT"
ext {
generatedDir = new File(buildDir, "generated-html")
}
def OXYGEN_HOME = "/opt/java/oxygen"
def schemaFiles = ["page", "metadata"]
schemaFiles.each { pageName ->
task "${pageName}SchemaTask"(type: JavaExec) {
mkdir generatedDir
classpath = files([
"$OXYGEN_HOME",
"$OXYGEN_HOME/classes",
"$OXYGEN_HOME/lib",
"$OXYGEN_HOME/lib/oxygen.jar",
"$OXYGEN_HOME/lib/oxygenDeveloper.jar",
"$OXYGEN_HOME/lib/fop.jar",
"$OXYGEN_HOME/lib/xmlgraphics-commons-1.5.jar",
"$OXYGEN_HOME/lib/batik-all-1.7.jar",
"$OXYGEN_HOME/lib/xercesImpl.jar",
"$OXYGEN_HOME/lib/xml-apis.jar",
"$OXYGEN_HOME/lib/org.eclipse.wst.xml.xpath2.processor_1.2.0.jar",
"$OXYGEN_HOME/lib/icu4j.jar",
"$OXYGEN_HOME/lib/saxon.jar",
"$OXYGEN_HOME/lib/saxon9ee.jar",
"$OXYGEN_HOME/lib/log4j.jar",
"$OXYGEN_HOME/lib/resolver.jar",
"$OXYGEN_HOME/lib/oxygen-emf.jar",
"$OXYGEN_HOME/lib/commons-httpclient-3.1.jar",
"$OXYGEN_HOME/lib/commons-codec-1.3.jar",
"$OXYGEN_HOME/lib/commons-logging-1.0.4.jar",
"$OXYGEN_HOME/lib/httpcore-4.3.2.jar",
"$OXYGEN_HOME/lib/httpclient-cache-4.3.5.jar",
"$OXYGEN_HOME/lib/httpclient-4.3.5.jar",
"$OXYGEN_HOME/lib/fluent-hc-4.3.5.jar",
"$OXYGEN_HOME/lib/httpmime-4.3.5.jar",
"$OXYGEN_HOME/lib/commons-logging-1.1.3.jar",
"$OXYGEN_HOME/lib/commons-codec-1.6.jar"
].toList())
main = 'ro.sync.xsd.documentation.XSDSchemaDocumentationGenerator'
jvmArgs = ["-Djava.awt.headless=true"]
args = ["schema/${pageName}.xsd", "-format:html", "-split:location", "-out:$generatedDir/${pageName}.html"]
}
}
task schema(dependsOn: tasks.matching { Task task -> task.name.endsWith("SchemaTask")}) {
}
defaultTasks 'schema'
I've documented the whole approach to build docs from XSD in the build process in this post http://jakub.marchwicki.pl/posts/2015/08/26/get-your-xsd-docs-as-build-process/ 我在本文中记录了构建过程中构建文档的整个方法http://jakub.marchwicki.pl/posts/2015/08/26/get-your-xsd-docs-as-build-process /
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.