Chapter 4. Hello World-Project

The standard directory structure is as follows:

The build file for ant looks like follows:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE project [
         <!ENTITY common "../common">
         <!ENTITY buildcommon SYSTEM "../common/build_common.xml">
]>
<project name="HelloWorld" default="html" basedir=".">1 
         <property name="lang" value="de"/>
         <target name="postprocess"/>
         <property name="project" value="HelloWorld"/>
         <property name="javahome" value="..."/>
         <property name="fileversion" value="1.0"/>2 
&buildcommon;
</project>       

This file only determines the project name and which document types will be generated as a standard.

1 Defines project name and standard target (here html).
2 Defines the project properties. Here the project name which is required as a variable in the shared control file for Ant build_common.xml.

Only missing is the contents; here the file HelloWorld.xml which is saved in the XML directory.

For the simplest HelloWorld this is only:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"../../common/docbook/dtd/docbookx.dtd">
<article lang="de">
 <articleinfo>
     <title>Hello World</title>
     <author>
       <firstname>Stefan</firstname>
       <surname>Rinke</surname>
     </author>
 </articleinfo>
 <section>
     <title>Hello World</title>
     <para>That's all.</para>
 </section>
</article>                   
       

Now we have everything we need for the first test. After having installed all tools, it should not be a problem to structure your fist project. If the following is returned:

make all
 BUILD SUCCESSFUL
Total time: 11 seconds                       

the dist directory under build should now contain all formats of the Hello World document created just now.