Building EPUBs with Apache Ant

The EPUB tools that I’ve been working on the past year or so is about to graduate and is now a part of the Mylyn Docs project. Currently it is only available in the nightly builds. If you would like to install the tooling you may do so from the p2 repository listed. You can also built it yourself from my public git repo which is a bit ahead.

As the video in one of my earlier posts demonstrates, it is easy to create EPUBs from within Eclipse using the conversion wizard. But this method is fairly limited and lack many of the features of the Ant task. The task can easily be used from within the Eclipse, but what if you want to use it in a build which does not utilize Eclipse? As it turns out, this is quite straightforward.

In order to execute the Ant task from outside of Eclipse we need the core EPUB features along with parts of EMF and the EPUB Ant task. The following bundles are those required:

  • epub-ant
  • org.eclipse.emf.common
  • org.eclipse.emf.ecore.xmi
  • org.eclipse.emf.ecore

Now, epub-ant.jar is a bit special. It is packaged within So if you build the tooling yourself, or use the nightly builds you need to dissect the bundle in order to get to the jar.

Don’t feel like digging for jar files and writing Ant scripts in order to try this out? No worries. Simply clone the git repository I’ve set up for examples and execute Ant in the various sub-folders. It contains a couple of examples (more to come) and also have the binaries you need.

If you need more information on how to use the tooling you can clone both the examples and the Mylyn Docs repositories and build the documentation EPUB (the “book” example) in order to read it on your favorite device. And if you feel adventurous you may want to try out the reader building on this tooling. It still have a few issues, but is quite usable and will of course allow you to read your (computer science) books from within Eclipse. You will have to build it from source, but there are instructions.

Leave a Reply