Scala and IDEs

131 views
Skip to first unread message

Russel Winder

unread,
Sep 17, 2012, 3:19:20 AM9/17/12
to Scala_Users
I thought I would try some IDEs instead of my usual Emacs/Bash for
Scala. I first tried Eclipse. Apparently the Scala plugin only works
for Eclipse 3 not Eclipse 4, which seems a bit problematic despite the
dreadfulness that is 4.2 compared to 3.7 on the UI front. Moreover the
Scala plugin only supports Java 5 and Java 6: Java 7 use is a "on your
own head be it", and Java 8 isn't even mentioned. There seems to be a
discord here between promotion of use of bleeding edge versions of
Scala, i.e. 2.10 milestones, verses support for using Scala with Eclipse
– which is very backward looking.

I then tried the JetBrains plugin in IntelliJ IDEA, it loads and allows
editing and such like, but seems unable to run tests. I have a project
with only tests and no code (very TDD :-) but there is no way to run the
tests. I will take this one to JetBrains as I believe this is an
official plugin of theirs.

Are there people out there successfully using these or do I just go back
to Emacs/Bash?
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel...@ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc

Tim Pigden

unread,
Sep 17, 2012, 3:33:45 AM9/17/12
to Russel Winder, Scala_Users
I use Intellij and it does work. I think I've used it with tests without any other code but memory is hazy. Using specs2 tests and a project configured with the gen-idea sbt plugin (although that's not essential but I've not done anything else for a while).
--
Tim Pigden
Optrak Distribution Software Limited
+44 (0)1992 517100
http://www.linkedin.com/in/timpigden
http://optrak.com
Optrak Distribution Software Ltd is a limited company registered in England and Wales.
Company Registration No. 2327613 Registered Offices: Orland House, Mead Lane, Hertford, SG13 7AT England 
This email and any attachments to it may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Optrak Distribution Software Ltd. If you are not the intended recipient of this email, you must neither take any action based upon its contents, nor copy or show it to anyone. Please contact the sender if you believe you have received this email in error.

Roland Kuhn

unread,
Sep 17, 2012, 3:35:34 AM9/17/12
to scala-user
Hi Russel,

I’m using the Scala IDE with eclipse 3.7 and Java7, and I’m very happy with it (I do use 2.1-M2 since that came out, and I’ve been using nightlies before that because Akka is on 2.10.0-M7). I don’t feel any need to chose a newer eclipse version, in fact my updates are completely driven by when Scala IDE drops support for one (memories of using Ganymede are still fresh in my mind); I don’t see what newer eclipse should buy me (the one bug I’m interested in seeing fixed has not yet been tackled, AFAIK). There are reports (and instructions?) about successfully using Eclipse 4.2, though.

Regards,

Roland

PS: you might want to take all I said with a grain of salt because I abandoned Emacs 11 years ago and switched to vi ;-)
Roland Kuhn
Typesafe – The software stack for applications that scale.
twitter: @rolandkuhn


Grégoire Neuville

unread,
Sep 17, 2012, 3:57:33 AM9/17/12
to scala...@googlegroups.com
>
> Are there people out there successfully using these or do I just go back
> to Emacs/Bash?

And what about Emacs + Ensime (https://github.com/aemoncannon/ensime) ?

> --
> Russel.
> =============================================================================
> Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel...@ekiga.net
> 41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk
> London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder



--
Grégoire Neuville


--
Grégoire Neuville

Russel Winder

unread,
Sep 17, 2012, 4:17:44 AM9/17/12
to Tim Pigden, Scala_Users
Tim,

On Mon, 2012-09-17 at 08:33 +0100, Tim Pigden wrote:
> I use Intellij and it does work. I think I've used it with tests
> without any other code but memory is hazy. Using specs2 tests and a
> project configured with the gen-idea sbt plugin (although that's not
> essential but I've not done anything else for a while).

I think my problems with IntelliJ IDEA stem from the fact that it
assumes you can connect to a Scala distribution straight from the Scala
download pages. I use Debian Unstable (*) and IntelliJ IDEA refuses to
accept the Debian packaging of Scala as a valid Scala installation.

I am trying to use ScalaTest. SBT from Bash runs the tests fine, which
is good as I can use Scala in my JAX London 2012 presentations. :-)

(*) And occasionally Fedora.
signature.asc

alex

unread,
Sep 17, 2012, 4:26:57 AM9/17/12
to scala...@googlegroups.com
17.09.2012 13:19, Russel Winder пишет:
> I thought I would try some IDEs instead of my usual Emacs/Bash for
> Scala. I first tried Eclipse. Apparently the Scala plugin only works
> for Eclipse 3 not Eclipse 4, which seems a bit problematic despite the
> dreadfulness that is 4.2 compared to 3.7 on the UI front. Moreover the
> Scala plugin only supports Java 5 and Java 6: Java 7 use is a "on your
> own head be it", and Java 8 isn't even mentioned. There seems to be a
> discord here between promotion of use of bleeding edge versions of
> Scala, i.e. 2.10 milestones, verses support for using Scala with Eclipse
> – which is very backward looking.
>
> I then tried the JetBrains plugin in IntelliJ IDEA, it loads and allows
> editing and such like, but seems unable to run tests. I have a project
> with only tests and no code (very TDD :-) but there is no way to run the
> tests. I will take this one to JetBrains as I believe this is an
> official plugin of theirs.
>
> Are there people out there successfully using these or do I just go back
> to Emacs/Bash?
Hi.
For Eclipse 4.2 you can download Scala IDE from here
http://scala-ide.org/download/nightly.html





Kevin Wright

unread,
Sep 17, 2012, 4:52:16 AM9/17/12
to alex, scala...@googlegroups.com
Nowadays, I generally advise using sbt-extras: https://github.com/paulp/sbt-extras
(a.k.a "the rebel cut")

Then combine with either the eclipse plugin: https://github.com/typesafehub/sbteclipse
Or the idea plugin: https://github.com/mpeltonen/sbt-idea

and generate the appropriate IDE project from the SBT command line.  This will then set up classpaths, the correct scala library, fast compilation, etc. for you.  There's absolutely no need to separately download the Scala library, or even a specific SBT version under this setup.

I also use this technique for simply launching a standalone REPL, and for Scala script files that can embed sbt-style dependency declarations.

Russel Winder

unread,
Sep 17, 2012, 5:04:37 AM9/17/12
to Kevin Wright, scala...@googlegroups.com
On Mon, 2012-09-17 at 09:52 +0100, Kevin Wright wrote:
> Nowadays, I generally advise using sbt-extras:
> https://github.com/paulp/sbt-extras
> (a.k.a "the rebel cut")

Is this the same shell script released via Typesafe:

#!/usr/bin/env bash
#
# A more capable sbt runner, coincidentally also called sbt.
# Author: Paul Phillips <pa...@typesafe.com>
# Author: Josh Suereth <joshua....@typesafe.com>
# Note: This is adapted from sbt-extras for installed usage.

# this seems to cover the bases on OSX, and someone will
# have to tell me about the others.

Seems to work just fine on Debian. Except for using Scala 2.9.1.
signature.asc

Jason Zaugg

unread,
Sep 17, 2012, 5:12:36 AM9/17/12
to Russel Winder, Kevin Wright, scala...@googlegroups.com
On Mon, Sep 17, 2012 at 11:04 AM, Russel Winder <rus...@winder.org.uk> wrote:
> On Mon, 2012-09-17 at 09:52 +0100, Kevin Wright wrote:
>> Nowadays, I generally advise using sbt-extras:
>> https://github.com/paulp/sbt-extras
>> (a.k.a "the rebel cut")
>
> Is this the same shell script released via Typesafe:
>
> #!/usr/bin/env bash
> #
> # A more capable sbt runner, coincidentally also called sbt.
> # Author: Paul Phillips <pa...@typesafe.com>
> # Author: Josh Suereth <joshua....@typesafe.com>
> # Note: This is adapted from sbt-extras for installed usage.
>
> # this seems to cover the bases on OSX, and someone will
> # have to tell me about the others.
>
> Seems to work just fine on Debian. Except for using Scala 2.9.1.

SBT 0.11.x itself is compiled against, and must run with, Scala 2.9.1.
This is independent of the version of Scala that your project is
compiled with.

-jason

Kevin Wright

unread,
Sep 17, 2012, 5:13:52 AM9/17/12
to Russel Winder, scala...@googlegroups.com
I'm not familiar with that variation on the script, but it looks to be the same.

SBT will use whatever scala version you've defined in your project's sbt file, look for the line:
scalaVersion := "2.9.1"

(or add one, if necessary)

over-and-above "vanilla" sbt, the sbt-extras script will also use whatever version of sbt is specified in project/build.properties - which should contain just a single line, e.g:
sbt.version=0.12.0

As and when newer SBT versions become available, just do a git pull against sbt-extras to get you up to date again.  For deployment machines and CI agents I have the git-pull configured to run as part of a puppet update, though you could easily schedule it to happen regularly using whatever mechanism you prefer.

Russel Winder

unread,
Sep 17, 2012, 5:17:39 AM9/17/12
to Kevin Wright, alex, scala...@googlegroups.com
On Mon, 2012-09-17 at 09:52 +0100, Kevin Wright wrote:
[…]
> Then combine with either the eclipse plugin:
> https://github.com/typesafehub/sbteclipse
> Or the idea plugin: https://github.com/mpeltonen/sbt-idea

The latter is not the official JetBrains plugin. I guess the former is
just the development version of the official Eclipse plugin as
distributed via the scala-ide Eclipse plugin repository?

> and generate the appropriate IDE project from the SBT command line. This
> will then set up classpaths, the correct scala library, fast compilation,
> etc. for you. There's absolutely no need to separately download the Scala
> library, or even a specific SBT version under this setup.

I had been generating projects using Gradle. I guess I should try SBT
though I have to admit I would prefer to stick with Gradle.

[…]
signature.asc

Jason Zaugg

unread,
Sep 17, 2012, 5:21:42 AM9/17/12
to Russel Winder, Kevin Wright, alex, scala...@googlegroups.com
On Mon, Sep 17, 2012 at 11:17 AM, Russel Winder <rus...@winder.org.uk> wrote:
> On Mon, 2012-09-17 at 09:52 +0100, Kevin Wright wrote:
> […]
>> Then combine with either the eclipse plugin:
>> https://github.com/typesafehub/sbteclipse
>> Or the idea plugin: https://github.com/mpeltonen/sbt-idea
>
> The latter is not the official JetBrains plugin. I guess the former is
> just the development version of the official Eclipse plugin as
> distributed via the scala-ide Eclipse plugin repository?

Neither is an IDE plugin. They are SBT plugins, that generate IDE
project configuration, based on the SBT project definition.

-jason

Kevin Wright

unread,
Sep 17, 2012, 5:23:42 AM9/17/12
to Russel Winder, alex, scala...@googlegroups.com
On 17 September 2012 10:17, Russel Winder <rus...@winder.org.uk> wrote:
On Mon, 2012-09-17 at 09:52 +0100, Kevin Wright wrote:
[…]
> Then combine with either the eclipse plugin:
> https://github.com/typesafehub/sbteclipse
> Or the idea plugin: https://github.com/mpeltonen/sbt-idea

The latter is not the official JetBrains plugin.  I guess the former is
just the development version of the official Eclipse plugin as
distributed via the scala-ide Eclipse plugin repository?


You mis-understand... These are not plugins for eclipse or intellij allowing the IDE to read SBT files.  They're plugins for SBT allowing it to generate eclipse or intellij files.

Much as the situation was in the early days of both Ant and Maven, I have yet to see an effective solution for any full-blooded IDE allowing it to work with sbt projects directly.

Russel Winder

unread,
Sep 17, 2012, 6:29:59 AM9/17/12
to Tim Pigden, Scala_Users
On Mon, 2012-09-17 at 08:33 +0100, Tim Pigden wrote:
> I use Intellij and it does work. I think I've used it with tests
> without any other code but memory is hazy. Using specs2 tests and a
> project configured with the gen-idea sbt plugin (although that's not
> essential but I've not done anything else for a while).

Prompted by Kevin's and Jason's comments I have SBT generating Eclipse
and IntelliJ IDEA projects. Thanks to Alex for pointing out how to get
the Scala plugin in to Eclipse 4.2. Now…

Eclipse imports the project and it all seems to work, except that I
cannot get a ScalaTest plugin so have to run the tests from Bash :-(

IntelliJ IDEA opens the project but is unable to find the ScalaTest jar
even though SBT from Bash runs it fine and it is listed as a dependency
by IntelliJ IDEA.

I am having a very sad experience here, but I will persevere :-)
signature.asc

HamsterofDeath

unread,
Sep 17, 2012, 6:50:06 AM9/17/12
to scala...@googlegroups.com
Am 17.09.2012 12:29, schrieb Russel Winder:
> On Mon, 2012-09-17 at 08:33 +0100, Tim Pigden wrote:
>> I use Intellij and it does work. I think I've used it with tests
>> without any other code but memory is hazy. Using specs2 tests and a
>> project configured with the gen-idea sbt plugin (although that's not
>> essential but I've not done anything else for a while).
> Prompted by Kevin's and Jason's comments I have SBT generating Eclipse
> and IntelliJ IDEA projects. Thanks to Alex for pointing out how to get
> the Scala plugin in to Eclipse 4.2. Now…
>
> Eclipse imports the project and it all seems to work, except that I
> cannot get a ScalaTest plugin so have to run the tests from Bash :-(
>
> IntelliJ IDEA opens the project but is unable to find the ScalaTest jar
> even though SBT from Bash runs it fine and it is listed as a dependency
> by IntelliJ IDEA.
>
> I am having a very sad experience here, but I will persevere :-)
i never went the sbt route, and i never had problems. is there something
special about your project? can you upload the complete thing so others
(me, for example) can take a look at it? (i've messed around pretty much
anywhere in idea's settings and know some dirty stuff, maybe i can find
something)

Roland Kuhn

unread,
Sep 17, 2012, 7:10:49 AM9/17/12
to Russel Winder, Tim Pigden, Scala_Users

17 sep 2012 kl. 12:29 skrev Russel Winder:

> On Mon, 2012-09-17 at 08:33 +0100, Tim Pigden wrote:
>> I use Intellij and it does work. I think I've used it with tests
>> without any other code but memory is hazy. Using specs2 tests and a
>> project configured with the gen-idea sbt plugin (although that's not
>> essential but I've not done anything else for a while).
>
> Prompted by Kevin's and Jason's comments I have SBT generating Eclipse
> and IntelliJ IDEA projects. Thanks to Alex for pointing out how to get
> the Scala plugin in to Eclipse 4.2. Now…
>
> Eclipse imports the project and it all seems to work, except that I
> cannot get a ScalaTest plugin so have to run the tests from Bash :-(
>
I just recently installed the ScalaTest plugin from http://scala-ide.org/download/ecosystem.html and while (for some reason) I do not get the test results in the ScalaTest view (instead it opens a new Runner application with a log), I can run tests just fine.

Regards,

Rolad

> IntelliJ IDEA opens the project but is unable to find the ScalaTest jar
> even though SBT from Bash runs it fine and it is listed as a dependency
> by IntelliJ IDEA.
>
> I am having a very sad experience here, but I will persevere :-)
> --
> Russel.
> =============================================================================
> Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel...@ekiga.net
> 41 Buckmaster Road m: +44 7770 465 077 xmpp: rus...@winder.org.uk
> London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder

Russel Winder

unread,
Sep 17, 2012, 7:38:37 AM9/17/12
to Roland Kuhn, Scala_Users
On Mon, 2012-09-17 at 13:10 +0200, Roland Kuhn wrote:
[….]
> I just recently installed the ScalaTest plugin from http://scala-ide.org/download/ecosystem.html and while (for some reason) I do not get the test results in the ScalaTest view (instead it opens a new Runner application with a log), I can run tests just fine.

Works a treat for me, thanks. At least in Eclipse 3.7, it will not load
into Eclipse 4.2.

Of course this now means two paths to getting the Scala plugin, this one
and the one given by Alex earlier! Hopefully they are in sync.
signature.asc

Daniel Sobral

unread,
Sep 17, 2012, 2:44:19 PM9/17/12
to Russel Winder, Tim Pigden, Scala_Users
On Mon, Sep 17, 2012 at 7:29 AM, Russel Winder <rus...@winder.org.uk> wrote:
>
> IntelliJ IDEA opens the project but is unable to find the ScalaTest jar
> even though SBT from Bash runs it fine and it is listed as a dependency
> by IntelliJ IDEA.

Just a note: you need to generate IntelliJ (or Eclipse) project files
*every time* you change SBT's build configuration. There's no magic
propagation of changes in build to changes in the project.

In particular, if you changed a libraryDependency, you must generate
the project files again (with the project closed) for IntelliJ or
Eclipse to be aware of the change.

Aside from that, CTRL-SHIFT-F10 over the name of the test class has
always worked for me on IntelliJ.

--
Daniel C. Sobral

I travel to the future all the time.
Reply all
Reply to author
Forward
0 new messages