Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Step1. Setup Properties for Scalac Task

You may edit (or add to) the Ant target in order to set up the appropriate properties for the scalac Ant task.

Code Block
<property name="scala-library.jar" value="${scala.home}/lib/scala-library.jar" />

<path id="build.classpath">
        <pathelement location="${scala-library.jar}" />
        <pathelement location="${wo.local.frameworks}/ERExtensions.framework/Resources/Java/ERExtensions.jar" />
	<pathelement location="${wo.local.frameworks}/ERJars.framework/Resources/Java/log4j-1.2.14.jar" />
	<pathelement location="${wo.system.frameworks}/JavaWebObjects.framework/Resources/Java/javawebobjects.jar" />
        <pathelement location="${wo.system.frameworks}/JavaEOAccess.framework/Resources/Java/javaeoaccess.jar" />
	<pathelement location="${wo.system.frameworks}/JavaEOControl.framework/Resources/Java/javaeocontrol.jar" />
	<pathelement location="${wo.system.frameworks}/JavaFoundation.framework/Resources/Java/javafoundation.jar" />	
	<pathelement location="${wo.local.frameworks}/ERAttachment.framework/Resources/Java/ERAttachment.jar" />
	<!--pathelement location="Other custom framework path, etc" /-->

        <pathelement location="bin" />
	<fileset dir="Libraries">
		<include name="*.jar" />
	<fileset dir="${wo.extensions}">
		<include name="*.jar" />

<taskdef resource="scala/tools/ant/antlib.xml">
		<pathelement location="${scala.home}/lib/scala-compiler.jar" />
		<pathelement location="${scala-library.jar}" />
  1. The first block of pathelements define the classpaths required by the scala compiler.
  2. The taskdef sets up the Ant scalac task

Step2. Edit the compile Target

Add the scalac task to the compile target. Make sure that it's placed after the mkdir task:

Code Block
<scalac srcdir="Sources" destdir="bin" classpathref="build.classpath">
    <include name="**/*.scala" />

Step3. Add an <otherclasspath> entry for scala-library.jar

In the build.woapp target, add the following entry to add Scala to the built classpath for your WebObjects app.

Code Block
<otherclasspath root="${scala.home}">
	<include name="lib/scala-library.jar" />

Step4. Add scala.home to

Finally, you must set the scala.home property in the file.
This is the location of the Scala installation on your system. e.g: /usr/share/scala