Sling supports the Scala programming language version 2.8.1 through optional modules located in
The following bundles are required for Scala support: scala-library, scala-compiler, Scala Script Engine, Apache Sling Scala Scripting Configuration. Note: In order to see the Scala scripting engine in action you can also use the Launchpad Contrib Testing module which comes with all necessary bundles (including the examples) pre-installed. See below.
mvn jetty:run -Pjcrinstall-teststo start Sling.
There are two example applications available in
/contrib/scripting/scala/samples: A simple Hello World programm and a more advanced Forum application. The examples require the Apache Sling Sample Path Based Resource Type Provider bundle. So lets install this bundle first:
mvn -P autoInstallBundle clean install -Dsling.url=http://localhost:8888/system/console.
Now the examples themselves:
mvn -P autoInstallBundle clean install -Dsling.url=http://localhost:8888/system/console. The hello world application is then available at http://localhost:8888/content/helloworld.html
mvn -P autoInstallBundle clean install -Dsling.url=http://localhost:8888/system/console. The form application is the available at http://localhost:8888/content/forum.html?sling:authRequestLogin=true. When prompted for credentials use admin/admin.
The Scala scripting bundle is configurable through the Apache Felix Web Management Console (PID: org.apache.sling.scripting.scala.config.SlingSettingsProvider).
scalac -help. Default is blank.
See these session slides for further information: