如何为scala安装antlib.xml以使ant工作?
现在,当我ant在包含scala任务的build.xml文件上运行时遇到以下错误.
[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.
Run Code Online (Sandbox Code Playgroud)
我已经解开了,scala-2.8.1.final/lib/scala-compiler.jar但我不知道在哪里放内容.
以下是build.xml中相应的ant代码片段:
<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>
Run Code Online (Sandbox Code Playgroud)
回答
以下代码在build.xml文件中很重要:
<!-- Define project …Run Code Online (Sandbox Code Playgroud)