Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Akka Actors library installed with the Scala IDE for Scala 2.10?

I have recently begun exploring Scala, and have started by installing the Scala IDE in my copy of Eclipse (Indigo). I initially installed the Scala IDE for Scala 2.9, but then noticed that there was a newer release available for Scala 2.10. Installing the newer plug-in over the older one seems to have worked, but...

Scala 2.10 has deprecated the older Scala Actors in favor of Akka Actors. Thus I'm trying to add an import to my toy Scala project:

import akka.actor.Actor

This is flagged in the IDE with the error

not found: object akka

When I look at my Scala project's properties, I indeed do not see any of the akka-* jar files that are mentioned in the Akka documentation.

Do they need to be downloaded and installed separately, even though the Scala IDE plug-in installed the rest of Scala 2.10? Or have package names changed as part of integrating Akka actors in place of the older Scala Actors? (The documentation doesn't say so, but the Scala 2.10 release is fairly recent...)

like image 716
Kaelin Colclasure Avatar asked Mar 07 '13 01:03

Kaelin Colclasure


2 Answers

No, they aren't packaged together.

The easiest way to make sure the Eclipse IDE can see your dependencies (Akka, and anything else referenced in your build.sbt file) is to let sbt do it using the sbteclipse plugin. Here's the instructions I wrote up for co-workers:


Install the "sbteclipse" plugin

This plugin will allow sbt to add the files/references that Eclipse needs to find all the dependencies that you specify in your build.sbt. Otherwise, you will be able to use the IDE, but you will seek all kinds of "object not found" errors.

Just make sure the plugin is being added in your global plugins.sbt file. This file (and it's path) may not exist so you may need to create it at the following location:

~/.sbt $ cd ~/.sbt/0.13/
~/.sbt/0.13 $ mkdir plugins

Edit/create the plugins.sbt file:

~/.sbt/0.13 $ vi plugins/plugins.sbt

then add this line (it may be the only line in the file):

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")

Running sbteclipse

To use this, you just navigate to a scala project on the commandline and run the following. If you already had Eclipse open, go ahead and restart it.

/sites/ewuser (master)$ sbt eclipse

References:

  • How to initialize a new Scala project in sbt, Eclipse and github
  • Official sbteclipse plugin
like image 147
doub1ejack Avatar answered Nov 15 '22 00:11

doub1ejack


The Akka artifacts are not bundled with the Scala IDE (yet), you will have to add “akka-actor_2.10” and friends to your project’s dependencies.

like image 33
Roland Kuhn Avatar answered Nov 14 '22 22:11

Roland Kuhn