Configuring Ant to Build Scala with WebObjects
Version 35.1 by Ravi Mendis on 2009/12/15 21:45
Step1. Setup Properties for Scalac Task
You may edit (or add to) the init.properties Ant target in order to set up the appropriate properties for the scalac Ant task.
<property name="scala-library.jar" value="${scala.home}/lib/scala-library.jar" />
<path id="build.classpath">
<pathelement location="${scala-library.jar}" />
<pathelement location="/Library/Frameworks/ERExtensions.framework/Resources/Java/ERExtensions.jar" />
<pathelement location="/Library/Frameworks/ERJars.framework/Resources/Java/log4j-1.2.14.jar" />
<pathelement location="/System/Library/Frameworks/JavaWebObjects.framework/Resources/Java/javawebobjects.jar" />
<pathelement location="/System/Library/Frameworks/JavaEOAccess.framework/Resources/Java/javaeoaccess.jar" />
<pathelement location="/System/Library/Frameworks/JavaEOControl.framework/Resources/Java/javaeocontrol.jar" />
<pathelement location="/System/Library/Frameworks/JavaFoundation.framework/Resources/Java/javafoundation.jar" />
<pathelement location="/Library/Frameworks/ERAttachment.framework/Resources/Java/ERAttachment.jar" />
<!--pathelement location="Other custom framework path, etc" /-->
<pathelement location="bin" />
<fileset dir="Libraries">
<include name="*.jar" />
</fileset>
<fileset dir="${wo.extensions}">
<include name="*.jar" />
</fileset>
</path>
<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${scala.home}/lib/scala-compiler.jar" />
<pathelement location="${scala-library.jar}" />
</classpath>
</taskdef>
Notes:
- The first block of pathelements define the classpaths required by the scala compile to compile any .scala files in your project.
- The taskdef sets up the Ant scalac task indicating the location of the
Step2. Edit the compile Target
Add the scalac task to the compile target. Make sure that it's placed after the mkdir task:
<scalac srcdir="Sources" destdir="bin" classpathref="build.classpath">
<include name="**/*.scala" />
</scalac>