Sep
20
2013

Functional Programming Principles in Scala using JetBrains IntelliJ IDEA

Another great shot of our friend the Whale of last week in Cape BridgewaterThis week I started the Coursera course Functional Programming Principles in Scala with Martin Odersky as instructor.

One of my first step was to have JetBrains IntelliJ IDEA working with the Scala programming language so that I can work on the course assignments using my preferred IDE.

I have seen that The Guardian published a blog post Functional Programming Principles in Scala: Setting up IntelliJ but it focus on the Unix-like operating systems (OSX and Linux). As I work on Windows I for sure installed it on my machine running Windows 8.1! I also use a different set of tools so here is the way I did it!

First of all I am assuming that you have JetBrains IntelliJ IDEA 12 and JDK installed.

From IntelliJ you need to install the Scala plugin so go to File / Settings then on the dialog search for plugins, click on Browse Repositories button and search for Scala then select Scala v.0.19.299 from JetBrains

Then you also need to install the SBT plugin also from JetBrains which is still in development and get nightly builds.

Add the following URL to the list of custom plugin repositories in Settings / Plugins / Browse Repositories / Manage Repositories:

http://download.jetbrains.com/scala/sbt-nightly-leda.xml

After that, you may install the plugin via Settings | Plugins | Browse Repositories. IDEA will check for the latest plugin builds automatically.

Now extract the assignment zip that the coursera course is providing; e.g. for the example assignment, unpack the example.zip to a folder then in IntelliJ use File / Import Project. IntelliJ already recognize the folder as project:

Click Next

Tick Use auto-import and click Finish. IntelliJ will then import your project:

Now you need to edit your project structure using File / Project Structure and choose Modules, then progfun-example

You will see on the dialog for the Source and Test Source Folders some folder in red, just click on the X to delete all the one in red to get to the following state, then finally click OK

Now navigate to the test file ListsSuite and press ALT – SHIFT – F10 to start the tests

And if you implemented the assignment you should see this results:

There is still two tests to fix in the first assignment, this is why there are red!

But as you can see now you have a full Scala development environment based on the great JetBrains IntelliJ IDEA IDE! Now you can code with pleasure!

I really enjoy the first week assignments and implemented the first two as coding Kata! And I even involved France-Anne for the second one; first time that she is coding something Smile . Very nice!

Comments (10) -

Pavel Fatin

Hi Laurent, thank you for publishing the updated instructions on how to set up IDEA for the Coursera class!

Rene Groeschke

thanks for that! I'm attending the same course and happy to use my favourite IDE instead of the scala IDE

laurentkempe

Hi Pavel and Rene!

You are welcome.

Krishna

my co-worker pointed me to this article. Thanks for write up. Do you know why scala compiler 2.10.2 in Libraries sections shows up as inactive while the rest of them shows up as active ?

Romell

I cant find the example... where that download?

laurentkempe

Krishna, Welcome, I don't know!

laurentkempe

Romell, examples are part of the coursera course

Schrodinger`Cat

Thanks a lot Smile

jeffery

AFter I created a new Project, I cannot import the example as Project.
But I could be able to import the example as Modules, and then click "Use auto-import".
Any idea?

laurentkempe

Jeffery: I use the import project to import the coursera assignments project and choose sbt module then auto-import

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect, certified Scrum Master and Founding Member.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent was awarded Most Valuable Professional (MVP) by Microsoft from April 2002 to April 2012.

JetBrains Academy Member
Certified ScrumMaster
My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List