DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Basic Ant Script With Vim & Jikes

  • submit to reddit
        Apache ant build XML. This will use jikes in place of javac. Any compiler error output is formatted so that vim can parse it.

ant is a modern alternative to make. The build script is an XML file. It works particularly well with java. Download it for free from the <a href="">Apache ant</a> site. Most people find ant a lot nicer to live with than make.

<?xml version="1.0"?>

<project name="Hello" default="compile" basedir=".">
  <property name="name" value="Hello"/>
  <property name="version" value="1.0"/>

  <!-- Project directories.

  <property name="build" value="build"/>
  <property name="dist" value="dist"/>
  <property name="src" value="src"/>

  <!-- Compiler directives.

  <property name="optimize" value="off"/>
  <property name="deprecation" value="on"/>
  <property name="debug" value="on"/>

  <property name="build.compiler" value="jikes"/>
  <property name="build.compiler.emacs" value="true"/>

  <target name="init">
    <mkdir dir="${build}"/>

  <!-- Compile all the .java files from the source directory into
       the build directory.

  <target name="compile" depends="init">
    <javac srcdir="${src}" destdir="${build}" includes="**/*.java"
      debug="${debug}" deprecation="${deprecation}" optimize="${optimize}">

  <target name="clean" depends="init">
    <delete dir="${build}"/>
    <delete dir="${dist}"/>

  <target name="test" depends="compile">
    <java classname="HelloWorld" fork="yes">
        <pathelement location="${build}"/>


Terrance MacGregor replied on Fri, 2009/01/02 - 4:12pm

Yeah! This helped out a lot. Thanks for putting in here.

Snippets Manager replied on Tue, 2008/01/29 - 4:21pm

thanks for this. worked nicely.