Sunday, 29 July 2012

Scala, Maven and Eclipse

You might be having trouble getting Scala IDE, Maven (m2e) and Eclipse to play nicely. In particular the More than one scala library found in the build path [...] At least one has an incompatible version. Please update the project build path so it contains only compatible scala libraries.

Try the following:
  1. Generate a scala project using the maven archetype scala-archetype-simple
  2. Edit the pom.xml with the following:
    • Change the scala.version to 2.9.2
    • Remove the unit testing dependencies (add the ones you need back later once you have the other stuff working - the default versions won't be compatible with 2.9.2)
    • Change the maven-surefire-plugin to 2.12
  3. Remove the sample test classes in src/test/scala/sample
  4. Import the maven project into eclipse: Package Explorer -> Import... -> Existing Maven Projects
This should now give you a mavenised Scala project loaded into Eclipse. If you have trouble with eclipse not updating with your pom changes, delete the project, clear out the eclipse stuff from the project dir (.project, .settings, .cache, etc) then re-import the maven project.

Also note that I'm using:

No comments: