Scala, Maven and IntelliJ

I’m evaluating Scala for a project I’ve recently started.  The project requires processing a large number of data structures.  Between Scala’s good support for parallelism and functional programming, it seems like a good fit.  I’ve heard Scala brings many of the development efficiencies and expressiveness of dynamic languages, while being statically typed.  It does this through a number of features, including smart type inferencing, great functional programming support, traits, and a bunch of other tricks I’m in the process of learning.

We’ve seen several dynamically typed languages gain widespread adoption in the last eight years or so… Python, Ruby, Groovy, and you can go back to Javascript, Perl, PHP, etc..  What’s the last statically typed language that’s gained a wide following?  C#?  I’ve pretty much come to assume that any new language that was highly expressive, concise, and good for DSLs, would be a dynamic language.  Dynamic languages do have their drawbacks..  performance is usually not up to par with statically typed languages (although it rarely makes a difference), and the lack of type information at compile type make it very difficult for IDEs to provide features such as autocomplete, symbol lookup, and early error detection.  So if languages such as Scala manage to deliver a highly development-efficient language while retaining static typing, that’s all the better in my eyes.

Here’s what I did to get a minimal project set up in Maven and IntelliJ IDEA:

Create a shell of a project using a Maven archetype:

mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create \
-DarchetypeGroupId=org.scala-tools.archetypes \
-DarchetypeArtifactId=scala-archetype-simple \
-DarchetypeVersion=1.1 \
-DremoteRepositories= \
-DgroupId=com.rps -DartifactId=scalatest

This created a project with a single Scala class, test, and a Maven POM containing the minimal dependencies and plugins.

The version of Scala generated by the archetype isn’t the most current. Just update the version in the POM:


to 2.7.6, or whatever is the version you want.

I then imported the project into IntelliJ IDEA using the excellent IDEA Maven integration.  I had to add the Scala nature to the project in IDEA myself, but otherwise, everything is working..  Editing, unit tests, debugging, etc.

The IntelliJ IDEA editor support for autocomplete seems to work pretty well, but it doesn’t seem to do much detection of errors as you’re editing yet.

This entry was posted in Scala and tagged , . Bookmark the permalink.

One Response to Scala, Maven and IntelliJ

  1. awaikls says:

    Спасибо за информацию!!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *