alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (build.xml)

This example Java source code file (build.xml) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

compile, create, delete, jdk, main-class, packageverify, put, requires

The build.xml Java example source code

<project name="PackageVerify" default="dist" basedir="..">
  <!-- Requires ant 1.6.1+ and JDK 1.7+-->

  <!-- set global properties for this build -->
  <property name="src"      value="${basedir}/src"/>
  <property name="build"    value="${basedir}/build"/>
  <property name="dist"     value="${basedir}/dist"/>
  <property name="make"     value="${basedir}/make"/>
  <property name="classes"  value="${build}/classes"/>
  <property name="api"      value="${build}/api"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${classes}"/>
    <mkdir dir="${api}"/>
  </target>

  <target name="compile" depends="init">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac 
	source="1.7"
	srcdir="${src}"
	destdir="${build}/classes"
	verbose="no"
	debug="on"
    />
  </target>

  <target name="doc" depends="init, compile">
      <javadoc
        source="1.7"
        sourcepath="${src}"
        destdir="${api}"
      />
  </target>
  <target name="dist" depends="compile, doc">
    <!-- Put everything in jar file -->
    <jar destfile="${dist}/pack200-verifier.jar">
	<manifest>
	   <attribute name="Main-Class" value="sun.tools.pack.verify.Main"/>
	</manifest>
	<fileset dir="${classes}"/>
    </jar>
    <zip destfile="dist/pack200-verifier-doc.zip">
        <fileset dir="${api}"/>
    </zip>
  </target>

  <target name="clean">
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>

</project>

Other Java examples (source code examples)

Here is a short list of links related to this Java build.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.