Generate EPUB using Ant

Using the epub Ant task one can assemble an EPUB during continuous building or from within Eclipse. The example below shows a complete minimum Ant script.

<?xml version="1.0" encoding="UTF-8"?>
<project name="Build an EPUB" default="build">
  <target name="build">
    <epub file="My Book.epub">
      <title>My Book</title>
      <subject>My Book's subject</subject>
      <item file="my_chapter.xhtml" />
    </epub>
  </target>
</project>

In this example only some of the required properties have been specified, the rest will be automatically added. See the comprehensive description of the epub Ant task for details. A more complete example is found in the examples chapter.

Note that in order for the script to execute the epub task must be in the classpath. If you execute the script from within Eclipse simply make sure that the runtime environment of the workspace is used as shown in the illustration below.

External task launch configuration.