Never been to DZone Snippets before?

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

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Basic ant script with vim & jikes

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 Apache ant 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">
    <tstamp/>
    <mkdir dir="${build}"/>
  </target>

  <!-- 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}">
    </javac>
  </target>

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

  <target name="test" depends="compile">
    <java classname="HelloWorld" fork="yes">
      <classpath>
        <pathelement location="${build}"/>
      </classpath>
    </java>
  </target>
</project>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS