Docbook and Maven

I’ve released two new versions of the maven sdocbook plugin (note that it’s called sdocbook for historical reasons but it uses the full docbook, not the simplified one). The latest version allows the creation of pdf, html in a single page and html splitted in sections. It also allows the customization of the stylesheets used for transformation.

It’s as easy as running maven sdocbook after you put the docbook source in the sdocbook folder.

To generate the docbook when building the site just add this postGoal to your maven.xml.

    <postGoal name="site">
        <attainGoal name="sdocbook"/>
    </postGoal>

There are two projects where I’ve implemented the docbook transformation using all the features:

  • ONess
  • Acegi Security System for Spring

If you’d like to generate the docbook files as part of the maven generated site (with the navigation bar on the left, logos and footer), you can try the following goal after generating the docbook files, but before xdoc goal.

    <goal name="docbook2xdoc">
        <maven:get var="maven.sdocbook.generated.html"
            plugin="maven-sdocbook-plugin"
            property="maven.sdocbook.generated.html"/>
        <mkdir dir="${maven.gen.docs}/docbook2xdoc"/>

        <j:set var="maven.html2xdoc.dir.bak" value="${maven.html2xdoc.dir}"/>
        <j:set var="maven.gen.docs.bak" value="${maven.gen.docs}"/>

        <j:set var="maven.html2xdoc.dir" value="${maven.sdocbook.generated.html}"/>
        <j:set var="maven.gen.docs" value="${maven.gen.docs}/docbook2xdoc"/>
        <attainGoal name="html2xdoc:transform"/>

        <j:set var="maven.html2xdoc.dir" value="${maven.html2xdoc.dir.bak}"/>
        <j:set var="maven.gen.docs" value="${maven.gen.docs.bak}"/>
    </goal>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s