用maven-jdocbook-plugin简单配置docbook5.0环境
很多人都说docbook配置环境比较繁琐,今天看了一下docbook5的文档,5.0不再使用旧的SGML DTD,转而使用XML,感觉配置相对容易多了,网上有篇文章介绍5.0的编译环境,真的比较简单.不过我今天看了看jboss seam的文档构建过程,构建环境搭建真是简单的不能再简单了,jboss seam使用maven来发布docbook文档,用到了maven-jdocbook-plugin,我把jboss seam的构建提取出来,大家可以参考来方便构建自己的docbook.
创建一个最最简单的maven空项目,pom.xml内容如下:
在src/main/docbook/zh_CN下新建两个xml文件master.xml,chap1.xml.这里用到了docbook的物理分割概念,就是把单个文档拆分文档为多个文件,这在文档比较巨大的时候很实用.
master.xml是文档主文件,内容如下:
chap1.xml是文档的第一章,内容如下:
ok,我们可以发布文档了,没错!就是这么简单,在项目根目录运行命令
如果大家不明白可以下载附件源码看看!样式还是使用jboss的,不过可以自己修改xsl!
样例代码
贴张图看看生成的文档,呵呵!


创建一个最最简单的maven空项目,pom.xml内容如下:
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.kuuyee</groupId>
<artifactId>first-docbook</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>first-docbook</name>
<build>
<plugins>
<!-- the docbook generation plugin for the user guide -->
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>2.1.1</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-docbook-xslt</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-jdocbook-style</artifactId>
<version>1.1.0</version>
<type>jdocbook-style</type>
</dependency>
</dependencies>
<executions>
<execution>
<id>tutorial_zh_CN</id>
<phase>package</phase>
<goals>
<goal>resources</goal>
<goal>generate</goal>
</goals>
<configuration>
<sourceDocumentName>master.xml</sourceDocumentName>
<sourceDirectory>${basedir}/src/main/docbook/zh_CN</sourceDirectory>
<imageResource>
<directory>${basedir}/src/main/docbook/images</directory>
</imageResource>
<cssResource>
<directory>${basedir}/src/main/docbook/css</directory>
</cssResource>
<targetDirectory>${basedir}/target/docbook/zh_CN</targetDirectory>
<formats>
<format>
<formatName>pdf</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
<finalName>zh_CN.pdf</finalName>
</format>
<format>
<formatName>html</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>html_single</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
<finalName>index.html</finalName>
</format>
</formats>
<options>
<xincludeSupported>true</xincludeSupported>
</options>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- basic JBoss repository so that the common parent POM in jbosscache-support can be found -->
<repositories>
<repository>
<id>snapshots.jboss.org</id>
<url>http://snapshots.jboss.org/maven2</url>
</repository>
<repository>
<id>repository.jboss.org</id>
<url>http://repository.jboss.org/maven2</url>
</repository>
</repositories>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.kuuyee</groupId>
<artifactId>first-docbook</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>first-docbook</name>
<build>
<plugins>
<!-- the docbook generation plugin for the user guide -->
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>2.1.1</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-docbook-xslt</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jbossorg-jdocbook-style</artifactId>
<version>1.1.0</version>
<type>jdocbook-style</type>
</dependency>
</dependencies>
<executions>
<execution>
<id>tutorial_zh_CN</id>
<phase>package</phase>
<goals>
<goal>resources</goal>
<goal>generate</goal>
</goals>
<configuration>
<sourceDocumentName>master.xml</sourceDocumentName>
<sourceDirectory>${basedir}/src/main/docbook/zh_CN</sourceDirectory>
<imageResource>
<directory>${basedir}/src/main/docbook/images</directory>
</imageResource>
<cssResource>
<directory>${basedir}/src/main/docbook/css</directory>
</cssResource>
<targetDirectory>${basedir}/target/docbook/zh_CN</targetDirectory>
<formats>
<format>
<formatName>pdf</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
<finalName>zh_CN.pdf</finalName>
</format>
<format>
<formatName>html</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>html_single</formatName>
<stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
<finalName>index.html</finalName>
</format>
</formats>
<options>
<xincludeSupported>true</xincludeSupported>
</options>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- basic JBoss repository so that the common parent POM in jbosscache-support can be found -->
<repositories>
<repository>
<id>snapshots.jboss.org</id>
<url>http://snapshots.jboss.org/maven2</url>
</repository>
<repository>
<id>repository.jboss.org</id>
<url>http://repository.jboss.org/maven2</url>
</repository>
</repositories>
</project>
在src/main/docbook/zh_CN下新建两个xml文件master.xml,chap1.xml.这里用到了docbook的物理分割概念,就是把单个文档拆分文档为多个文件,这在文档比较巨大的时候很实用.
master.xml是文档主文件,内容如下:
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><?xml version='1.0' encoding="utf-8"?>
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="zh-CN" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>光子的第一本Docbook书</title>
<xi:include href="chap1.xml"/>
</book>
<book xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="zh-CN" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>光子的第一本Docbook书</title>
<xi:include href="chap1.xml"/>
</book>
chap1.xml是文档的第一章,内容如下:
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><?xml version='1.0' encoding="utf-8"?>
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="zh-CN"
xmlns:xlink="http://www.w3.org/1999/xlink" id="ch1" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>光子的第一篇Docbook 5.0文档</title>
<section>
<title>第一章标题</title>
<para>
这是光子的第一篇Docbook 5.0文档,我的BLOG<link xlink:href='http://www.blogjava.net/kuuyee/'>光子CI之旅</link>。
</para>
</section>
</chapter>
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:lang="zh-CN"
xmlns:xlink="http://www.w3.org/1999/xlink" id="ch1" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>光子的第一篇Docbook 5.0文档</title>
<section>
<title>第一章标题</title>
<para>
这是光子的第一篇Docbook 5.0文档,我的BLOG<link xlink:href='http://www.blogjava.net/kuuyee/'>光子CI之旅</link>。
</para>
</section>
</chapter>
ok,我们可以发布文档了,没错!就是这么简单,在项目根目录运行命令
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
-->mvn clean package
如果大家不明白可以下载附件源码看看!样式还是使用jboss的,不过可以自己修改xsl!
样例代码
贴张图看看生成的文档,呵呵!
发表评论
-
构建 Apache ODE 开发环境
2009-04-05 19:39 1230今天搭建了ODE开发环境,根据官方文档的说明要先安装Ruby ... -
Linux批量替换文件内容
2009-05-27 10:21 880这两天在构建一个应用的使用用到了maven,由于projec ... -
maven-tomcat-plugin试用
2009-07-21 14:13 989maven-tomcat-plugin能够方便的部署war应用 ... -
Ubuntu下更改Mysql默认字符集
2009-07-22 11:01 912在ubuntu安装Mysql Server比较简单,一条命令就 ... -
开启Mysql远程访问
2009-07-22 13:52 884Mysql默认是不可以通过远程机器访问的,通过下面的配置可以开 ... -
Sonar安装笔记
2009-07-23 17:21 3338Sonar是开源的代码质量管理平台,它把代码质量相关软件集成到 ... -
向Docbook5.0过渡系列(2)-给Image加链接
2009-08-02 15:16 1038在docbook内添加一个图片很简单,使用<mediao ... -
JDK7 第四个里程碑版本放出(译)
2009-08-04 02:20 852原文:http://blogs.sun.com/mr/entr ... -
vSphere使用中的两个问题
2009-08-26 11:33 11811.WebAccess 不能访问。 问题原因 一般是WebAc ... -
vSphere使用中的vCenter链接主机的问题
2009-09-03 11:42 1745使用vCenter链接新安装的vSphere主机会报如下错误 ... -
ubuntu指定静态IP
2009-09-03 16:38 829默认情况下ubuntu是用dhcp来获取IP的,对于但用户来说 ... -
Linux下挂载远程Windows共享目录
2009-09-04 18:18 1144环境:CentOS5.3 远程Windows IP:192.1 ... -
CentOS5.3设定静态IP
2009-09-22 13:52 863首先进入/etc/sysconfig/network-scri ... -
CentOS下KVM试用
2010-12-07 15:32 2372可以到我的网站阅读 ...
相关推荐
maven-jdocbook-plugin-2.2.2.jar
本文详细介绍了exec-maven-plugin的基本概念、配置方法、执行简单和系统脚本、捕获命令输出、条件执行、并发执行、使用环境变量、错误处理、高级配置、使用案例以及局限性。通过这些知识点,读者可以更加自信地在...
maven-jdocbook-style-plugin-2.0.0.jar
maven-jdocbook-plugin-2.3.4.jar
maven-jdocbook-plugin-2.3.3.jar
maven-jdocbook-plugin-2.3.2.jar
maven-jdocbook-plugin-2.3.1.jar
maven-jdocbook-plugin-2.3.0.jar
maven-jdocbook-plugin-2.2.3.jar
maven-jdocbook-plugin-2.2.1.jar
maven-jdocbook-plugin-2.2.0.jar
maven-jdocbook-plugin-2.1.2.jar
maven-jdocbook-plugin-2.1.1.jar
maven-jdocbook-plugin-2.1.0.jar
maven-jdocbook-plugin-2.0.0.jar
maven-jdocbook-style-plugin-2.0.0-sources.jar
maven-jdocbook-style-plugin-1.0.0-sources.jar
maven-jdocbook-plugin-2.3.4-sources.jar
maven-jdocbook-plugin-2.3.3-sources.jar
maven-jdocbook-plugin-2.3.2-sources.jar