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

ant, copyright, for, foundation, free, general, gnu, license, oracle, public, software, the, this, usa

The build.xml Java example source code

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

 This code is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License version 2 only, as
 published by the Free Software Foundation.

 This code is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 version 2 for more details (a copy is included in the LICENSE file that
 accompanied this code).

 You should have received a copy of the GNU General Public License version
 2 along with this work; if not, write to the Free Software Foundation,
 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

 Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 or visit www.oracle.com if you need additional information or have any
 questions.
  
-->

<!-- This is an Ant project file. Ant is a build tool like make or gnumake which is not
     dependent on the underlying OS shell. For more information on Ant, please see
     http://ant.apache.org/ -->

<!-- A "project" describes a set of targets that may be requested
     when Ant is executed.  The "default" attribute defines the
     target which is executed if no specific target is requested,
     and the "basedir" attribute defines the current working directory
     from which Ant executes the requested task.  This is normally
     set to the current working directory.
-->


<project name="HotSpot Serviceability Agent" default="all" basedir=".">

  <!-- Property Definitions -->

  <property name="app.name" value="sa"/>
  <property name="dist.jar" value="${app.name}.jar"/>
  <property name="classes"  value="../build/classes"/>

<!-- The "prepare" target is used to construct the deployment home
     directory structure (if necessary), and to copy in static files
     as required.  In the example below, Ant is instructed to create
     the deployment directory, copy the contents of the "web/" source
     hierarchy, and set up the WEB-INF subdirectory appropriately.
-->

  <target name="prepare">
    <mkdir dir="${classes}"/>
  </target>


<!-- The "clean" target removes the deployment home directory structure,
     so that the next time the "compile" target is requested, it will need
     to compile everything from scratch.
-->

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


<!-- The "compile" target is used to compile (or recompile) the Java classes
     that make up this web application.  The recommended source code directory
     structure makes this very easy because the <javac> task automatically
     works its way down a source code hierarchy and compiles any class that
     has not yet been compiled, or where the source file is newer than the
     class file.

     Feel free to adjust the compilation option parameters (debug,
     optimize, and deprecation) to suit your requirements.  It is also
     possible to base them on properties, so that you can adjust this
     behavior at runtime.

     The "compile" task depends on the "prepare" task, so the deployment
     home directory structure will be created if needed the first time.
-->

  <target name="compile" depends="prepare" description="Compiles the sources">
    <javac srcdir="../src/share/classes" 
           destdir="${classes}"
           debug="on" deprecation="on"
           source="1.4">
      <classpath refid="javac.classpath" />
    </javac>

    <rmic classname="sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer"
	  base="${classes}"/>
  </target>

  <target name="deploy" depends="compile" description="Creates a deployment bundle">
    <delete file="${classes}/${dist.jar}" />
    <copy todir="${classes}/sun/jvm/hotspot/utilities/soql/">
      <fileset dir="../src/share/classes/sun/jvm/hotspot/utilities/soql" includes="*.js" />
    </copy>

    <mkdir dir="${classes}/sun/jvm/hotspot/ui/resources" />
    <copy todir="${classes}/sun/jvm/hotspot/ui/resources">
      <fileset dir="../src/share/classes/sun/jvm/hotspot/ui/resources" includes="*.png" />
    </copy>
    <copy todir="${classes}/toolbarButtonGraphics/development/">
      <fileset dir="../src/share/classes/images/toolbarButtonGraphics/development/" includes="*.gif" />
    </copy>
    <copy todir="${classes}/toolbarButtonGraphics/general/">
      <fileset dir="../src/share/classes/images/toolbarButtonGraphics/general/" includes="*.gif" />
    </copy>
    <copy todir="${classes}/toolbarButtonGraphics/navigation/">
      <fileset dir="../src/share/classes/images/toolbarButtonGraphics/navigation/" includes="*.gif" />
    </copy>
    <copy todir="${classes}/toolbarButtonGraphics/text/">
      <fileset dir="../src/share/classes/images/toolbarButtonGraphics/text/" includes="*.gif" />
    </copy>

    <jar jarfile="${classes}/${dist.jar}"
         basedir="${classes}"/>
  </target>

  <target name="all" depends="deploy" description="Builds sources and deployment jar"/>

</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.