Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3678264
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:19:13+00:00 2026-05-19T03:19:13+00:00

How do I install the antlib.xml for scala to get ant working? Right now

  • 0

How do I install the antlib.xml for scala to get ant working?

Right now I encounter the following error when I run ant on a build.xml file that contains scala tasks.

[taskdef] Could not load definitions from resource scala/tools/ant/antlib.xml. It could not be found.
/scalala/scalala-read-only/scalala/build.xml:36: Problem: failed to create task or type scalac 

Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

I have unjarred the scala-2.8.1.final/lib/scala-compiler.jar but I don’t know where to put the contents.

Here is the corresponding ant code snippet from the build.xml:

  <target name="compile" depends="">
    <mkdir dir="${build.dir}"/>

    <scalac srcdir="${src.dir}" destdir="${build.dir}"
            classpathref="project.classpath" force="changed">
            <!-- addparams="-Yclosure-elim -optimise" -->
      <include name="**/*.scala"/>
    </scalac>
  </target>

Answer

The following code is important to have in your build.xml file:

  <!-- Define project CLASSPATH. -->
  <path id="project.classpath">
    <pathelement location="${build.dir}" />

    <fileset dir="${env.SCALA_HOME}/lib/"> <include name="*.jar" /> </fileset>

    <fileset dir="${lib.dir}"> <include name="*.jar" /> </fileset>
  </path>

  <!-- Define scala compiler, scaladoc, etc command -->
  <taskdef resource="scala/tools/ant/antlib.xml">
    <classpath>
      <pathelement location="${env.SCALA_HOME}/lib/scala-compiler.jar" />
      <pathelement location="${env.SCALA_HOME}/lib/scala-library.jar" />
    </classpath>
  </taskdef>

My problem was that the $SCALA_HOME environment variable (${env.SCALA_HOME}) was pointing to the wrong place (one level too deep: /usr/local/scala-2.8.1.final/bin/ rather than just /usr/local/scala-2.8.1.final/, and therefore the lib directory could not be found.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:19:14+00:00Added an answer on May 19, 2026 at 3:19 am

    The antlib.xml is contained in the scala-compiler.jar. You have to put it into your classpath. To define the scalacant task, put the following definition into your ant build file (this is taken form http://www.scala-lang.org/node/98):

    <target name="init">
      <property
        name="scala-library.jar"
        value="${scala.home}/lib/scala-library.jar"
         />
      <path id="build.classpath">
        <pathelement location="${scala-library.jar}"   />
        <!--<pathelement location="${your.path}"   />-->
        <pathelement location="${build.dir}"   />
      </path>
      <taskdef resource="scala/tools/ant/antlib.xml">
        <classpath>
          <pathelement location="${scala.home}/lib/scala-compiler.jar"   />
          <!-- NEW: For scala 2.10.2 you need scala-reflect: -->
          <pathelement location="${scala.home}/lib/scala-reflect.jar"   />
          <pathelement location="${scala-library.jar}"   />
        </classpath>
      </taskdef>
    </target>
    

    To use the scalac task, add the attribute depends="init" to your task, e.g.

    <target name="compile" depends="init">
      <mkdir dir="${build.dir}"/>
    
      <scalac srcdir="${src.dir}" destdir="${build.dir}"
              classpathref="project.classpath" force="changed">
              <!-- addparams="-Yclosure-elim -optimise" -->
        <include name="**/*.scala"/>
      </scalac>
    </target>
    

    I hope, that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a project using Ant and Ivy. The build.xml file depends on
I have a POM defined in the Ant file, the build works correctly, pulling
I can't get either the FTP nor the MySQL Task working for Ant 1.8.2
pip install --upgrade distribute throws the following error. Downloading/unpacking distribute from http://pypi.python.org/packages/sourc e/d/distribute/distribute-0.6.25.tar.gz#md5=a690874b9964d958a3200485eb827b1 d
The install instructions are: $ python setup.py build $ sudo python setup.py install #
AssemblyInstaller.Install expects a System.Collections.IDictionary. Am I right to be 'allergic' to using non-generic collections
I install plugin open_id_authentication and have this error: /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require': no such file to
gem install heroku failed with following message and I have tried the solution here
so I tried to install the android development tools but then I get this
I want to install Android SDK on Eclipse Classic Indigo (Version: 3.7.1 Build id:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.