This page is no longer maintained — Please continue to the home page at

Installing Scala Ant Tasks

1 reply
Bastian, Mark
Joined: 2009-01-16,
User offline. Last seen 42 years 45 weeks ago.
Joined: 2008-10-08,
User offline. Last seen 1 year 38 weeks ago.
Re: Installing Scala Ant Tasks
Here's an example of a full ANT build script (I edited out my stuff so might need some adjustments):

<?xml version="1.0" encoding="UTF-8"?>

<project name="Example script" default="build" basedir=".">
<description> Build script </description>

<!-- Main targets -->
<target name="build" depends="package">

<!-- Compiler settings -->
<property name="jvm-target" value="jvm-1.5"/>

<!-- Paths -->
<property name="scala.lib.dir" location="${SCALA_HOME}/lib"/>
<property name="src.dir" location="${basedir}/src" />
<property name="lib.dir" location="${basedir}/lib"/>
<property name="build.dir" location="${basedir}/build"/>
<property name="" location="${build.dir}/classes"/>
<property name="" location="${build.dir}/lib"/>
<property name="java.home" location="${JAVA_HOME}"/>

<path id="project.classpath">
    <pathelement location="${scala.lib.dir}/scala-library.jar"/>

<!-- Scala compiler task -->
<taskdef resource="scala/tools/ant/antlib.xml">
        <pathelement location="${scala.lib.dir}/scala-compiler.jar"/>
        <pathelement location="${scala.lib.dir}/scala-library.jar"/>

<!-- Targets -->
<target name="clean">
    <delete dir="${build.dir}"/>

<target name="compile" depends="clean">
    <mkdir dir="${}"/>
    <scalac srcdir="${src.dir}" destdir="${}" target="${jvm-target}" classpathref="project.classpath" force="yes" deprecation="yes">
        <include name="**/*.scala"/>

<target name="package" depends="compile">
    <mkdir dir="${}"/>
    <jar destfile="${}/example.jar">
        <fileset dir="${}"/>


On Fri, Jan 16, 2009 at 4:27 PM, Bastian, Mark <mbastia [at] sandia [dot] gov> wrote:
Hi Folks,   I am trying to figure out how to install the scala ant tasks. Several examples show a scalac task, but I don't see any documentation on what jars are required on the Ant path for this. Is placing scala-library.jar and scala-compiler.jar in ANT_HOME\lib sufficient? Also, can anyone tell me the correct xml namespace declaration to put in the build.xml project settings (e.g. for ivy, I'd out something like xmlns:ivy="antlib:fr.jayasoft.ivy.ant")?   Thanks, Mark  

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland