Skip to main content

Ant Task to generate an XML Sitemap

·1 min

I use Ant for more than just Java projects, including building my own website. So I have written an Ant task to generate an XML Sitemap and released the first version.

Here is an example of using the task:

<target name="generate_sitemap" description="generates the sitemap">
    <taskdef classname="uk.co.arjones.ant.task.Sitemap" name="sitemap"></taskdef>
    <sitemap url="http://andrew-jones.com" gzip="yes" lastmod="now" destdir="${BUILD_DIR}">
        <fileset dir="${BUILD_DIR}">
            <include name="**.htm"></include>
            <include name="**.html"></include>
            <exclude name="google*"></exclude>
        </fileset>
    </sitemap>
</target>

Its pretty self-explanatory. For more information and to download it, go to the project page on GitHub.