<project name="protobuf-java" default="jar" basedir="..">
    <property name="srcdir" value="src" />
    <property name="javadir" value="java" />
    <property name="javasrcdir" value="${javadir}/src" />
    <property name="targetdir" value="${javadir}/target" />
    <property name="classesdir" value="${targetdir}/classes" />
    <property name="generateddir" value="${targetdir}/generated-sources" />


    <target name="clean">
        <delete dir="${targetdir}"/>
    </target>

    <target name="generate">
        <mkdir dir="${generateddir}" />
        <echo message="${srcdir}" />
        <exec executable="${srcdir}/protoc">
            <arg value="--java_out=${generateddir}" />
            <arg value="--proto_path=${srcdir}" />
            <arg value="${srcdir}/google/protobuf/descriptor.proto" />
        </exec>
    </target>

    <target name="compile" depends="generate">
        <mkdir dir="${classesdir}"/>
        <javac srcdir="${generateddir}:${javasrcdir}/main/java"
               destdir="${classesdir}" source="1.5" target="1.5" />
    </target>

    <target name="jar" depends="compile">
        <jar destfile="${targetdir}/protobuf-2.4.0a.jar" basedir="${classesdir}" />
    </target>
</project>

<project name="protobuf-java" default="jar" basedir="..">
    <property name="srcdir" value="src" />
    <property name="javadir" value="java" />
    <property name="javasrcdir" value="${javadir}/src" />
    <property name="targetdir" value="${javadir}/target" />
    <property name="classesdir" value="${targetdir}/classes" />
    <property name="generateddir" value="${targetdir}/generated-sources" />

    <target name="clean">
        <delete dir="${targetdir}"/>
    </target>

    <target name="generate">
        <mkdir dir="${generateddir}" />
        <echo message="${srcdir}" />
        <exec executable="${srcdir}/protoc">
            <arg value="--java_out=${generateddir}" />
            <arg value="--proto_path=${srcdir}" />
            <arg value="${srcdir}/google/protobuf/descriptor.proto" />
        </exec>
    </target>

    <target name="compile" depends="generate">
        <mkdir dir="${classesdir}"/>
        <javac srcdir="${generateddir}:${javasrcdir}/main/java"
               destdir="${classesdir}" source="1.5" target="1.5"
               includeantruntime="false" />
    </target>

    <target name="jar" depends="compile">
        <jar destfile="${targetdir}/protobuf-2.4.0a.jar" basedir="${classesdir}" />
    </target>
</project>

Update and file to make repeatable builds
Update and file to make repeatable builds

Per the build log:

  compile:
    [mkdir] Created dir: /tmp/build-area/protobuf-2.4.0a/java/target/classes
    [javac] /tmp/build-area/protobuf-2.4.0a/debian/java-build.xml:27: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

We do want repeatable builds, so setting that property to false.
