title: Getting started with Scala, Scalatest, and Maven
body: <p>I created a new scala project with the following:</p>
  
  <pre><code>mvn org.apache.maven.plugins:maven-archetype-plugin:2.2:generate 
      -DarchetypeGroupId=org.scala-tools.archetypes 
      -DarchetypeArtifactId=scala-archetype-simple 
      -DarchetypeVersion=1.3 
      -DgroupId=myGroup 
      -DartifactId=myProject
      -Dversion=0.1.0 
      -DinteractiveMode=false
  </code></pre>
  
  <p>Which gives me the following POM:</p>
  
  <pre><code> &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
     &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
     &lt;groupId&gt;myGroup&lt;/groupId&gt;
     &lt;artifactId&gt;myProject&lt;/artifactId&gt;
     &lt;version&gt;0.1.0&lt;/version&gt;
     &lt;name&gt;${project.artifactId}&lt;/name&gt;
     &lt;description&gt;My wonderfull scala app&lt;/description&gt;
     &lt;inceptionYear&gt;2010&lt;/inceptionYear&gt;
     &lt;licenses&gt;
       &lt;license&gt;
         &lt;name&gt;My License&lt;/name&gt;
         &lt;url&gt;http://....&lt;/url&gt;
         &lt;distribution&gt;repo&lt;/distribution&gt;
       &lt;/license&gt;
     &lt;/licenses&gt;
  
     &lt;properties&gt;
       &lt;maven.compiler.source&gt;1.5&lt;/maven.compiler.source&gt;
       &lt;maven.compiler.target&gt;1.5&lt;/maven.compiler.target&gt;
       &lt;encoding&gt;UTF-8&lt;/encoding&gt;
       &lt;scala.version&gt;2.8.0&lt;/scala.version&gt;
     &lt;/properties&gt;
  
   &lt;!--
     &lt;repositories&gt;
       &lt;repository&gt;
         &lt;id&gt;scala-tools.org&lt;/id&gt;
         &lt;name&gt;Scala-Tools Maven2 Repository&lt;/name&gt;
         &lt;url&gt;http://scala-tools.org/repo-releases&lt;/url&gt;
       &lt;/repository&gt;
     &lt;/repositories&gt;
  
     &lt;pluginRepositories&gt;
       &lt;pluginRepository&gt;
         &lt;id&gt;scala-tools.org&lt;/id&gt;
         &lt;name&gt;Scala-Tools Maven2 Repository&lt;/name&gt;
         &lt;url&gt;http://scala-tools.org/repo-releases&lt;/url&gt;
       &lt;/pluginRepository&gt;
     &lt;/pluginRepositories&gt;
   --&gt;
     &lt;dependencies&gt;
       &lt;dependency&gt;
         &lt;groupId&gt;org.scala-lang&lt;/groupId&gt;
         &lt;artifactId&gt;scala-library&lt;/artifactId&gt;
         &lt;version&gt;${scala.version}&lt;/version&gt;
       &lt;/dependency&gt;
  
       &lt;!-- Test --&gt;
       &lt;dependency&gt;
         &lt;groupId&gt;junit&lt;/groupId&gt;
         &lt;artifactId&gt;junit&lt;/artifactId&gt;
         &lt;version&gt;4.8.1&lt;/version&gt;
         &lt;scope&gt;test&lt;/scope&gt;
       &lt;/dependency&gt;
       &lt;dependency&gt;
         &lt;groupId&gt;org.scala-tools.testing&lt;/groupId&gt;
         &lt;artifactId&gt;specs_${scala.version}&lt;/artifactId&gt;
         &lt;version&gt;1.6.5&lt;/version&gt;
         &lt;scope&gt;test&lt;/scope&gt;
       &lt;/dependency&gt;
       &lt;dependency&gt;
         &lt;groupId&gt;org.scalatest&lt;/groupId&gt;
         &lt;artifactId&gt;scalatest&lt;/artifactId&gt;
         &lt;version&gt;1.2&lt;/version&gt;
         &lt;scope&gt;test&lt;/scope&gt;
       &lt;/dependency&gt;
     &lt;/dependencies&gt;
  
     &lt;build&gt;
       &lt;sourceDirectory&gt;src/main/scala&lt;/sourceDirectory&gt;
       &lt;testSourceDirectory&gt;src/test/scala&lt;/testSourceDirectory&gt;
       &lt;plugins&gt;
         &lt;plugin&gt;
           &lt;groupId&gt;org.scala-tools&lt;/groupId&gt;
           &lt;artifactId&gt;maven-scala-plugin&lt;/artifactId&gt;
           &lt;version&gt;2.15.0&lt;/version&gt;
           &lt;executions&gt;
             &lt;execution&gt;
               &lt;goals&gt;
                 &lt;goal&gt;compile&lt;/goal&gt;
                 &lt;goal&gt;testCompile&lt;/goal&gt;
               &lt;/goals&gt;
               &lt;configuration&gt;
                 &lt;args&gt;
                   &lt;arg&gt;-make:transitive&lt;/arg&gt;
                   &lt;arg&gt;-dependencyfile&lt;/arg&gt;
                   &lt;arg&gt;${project.build.directory}/.scala_dependencies&lt;/arg&gt;
                 &lt;/args&gt;
               &lt;/configuration&gt;
             &lt;/execution&gt;
           &lt;/executions&gt;
         &lt;/plugin&gt;
         &lt;plugin&gt;
           &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
           &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
           &lt;version&gt;2.6&lt;/version&gt;
           &lt;configuration&gt;
             &lt;useFile&gt;false&lt;/useFile&gt;
             &lt;disableXmlReport&gt;true&lt;/disableXmlReport&gt;
             &lt;!-- If you have classpath issue like NoDefClassError,... --&gt;
             &lt;!-- useManifestOnlyJar&gt;false&lt;/useManifestOnlyJar --&gt;
             &lt;includes&gt;
               &lt;include&gt;**/*Test.*&lt;/include&gt;
               &lt;include&gt;**/*Suite.*&lt;/include&gt;
             &lt;/includes&gt;
           &lt;/configuration&gt;
         &lt;/plugin&gt;
       &lt;/plugins&gt;
     &lt;/build&gt;
   &lt;/project&gt;
  </code></pre>
  
  <p>I can run <code>mvn test</code> and the sample tests run successfully.  I'd like to use the most recent version of scala (I downloaded / installed 2.9.2...), but the <a href="http://mvnrepository.com/artifact/org.scala-tools.testing">most recent version of the org.scala-tools.testing scala_VERSION dependency seems to be 2.9.1</a>.  I made the following changes in my POM:</p>
  
  <pre><code>    &lt;scala.version&gt;2.9.1&lt;/scala.version&gt;
  </code></pre>
  
  <p>and </p>
  
  <pre><code>    &lt;dependency&gt;
         &lt;groupId&gt;org.scala-tools.testing&lt;/groupId&gt;
         &lt;artifactId&gt;specs_${scala.version}&lt;/artifactId&gt;
         &lt;version&gt;1.6.5&lt;/version&gt;
         &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Now, running <code>mvn test</code> gives </p>
  
  <pre><code> -------------------------------------------------------
    T E S T S
   -------------------------------------------------------
   Running samples.ListSuite
   Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.674 sec &lt;&lt;&lt; FAILURE!
   initializationError(samples.ListSuite)  Time elapsed: 0.003 sec  &lt;&lt;&lt; ERROR!
   java.lang.ClassCastException: scala.collection.immutable.Set$EmptySet$ cannot be
    cast to scala.collection.generic.Addable
           at org.scalatest.FunSuite$class.test(FunSuite.scala:1039)
           at samples.ListSuite.test(scalatest.scala:59)
           at samples.ListSuite.&lt;init&gt;(scalatest.scala:61)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
           at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
           at java.lang.Class.newInstance0(Class.java:372)
           at java.lang.Class.newInstance(Class.java:325)
           at org.scalatest.junit.JUnitRunner.&lt;init&gt;(JUnitRunner.scala:62)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
           at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
           at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
           at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
           at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
           at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
           at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
           at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
           at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:51)
           at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
           at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
           at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
           at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
  
   Running samples.StackSuite
   Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.12 sec
   Running samples.AppTest
   Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
  
   Results :
  
   Tests in error:
     initializationError(samples.ListSuite)
  
   Tests run: 4, Failures: 0, Errors: 1, Skipped: 0
  
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 6.880s
   [INFO] Finished at: Wed Oct 10 01:10:56 ADT 2012
   [INFO] Final Memory: 9M/112M
   [INFO] ------------------------------------------------------------------------
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.6:test (default-test) on project myProject: There are test failures.
   [ERROR]
   [ERROR] Please refer to C:\Dropbox\work\dev\scalasandbox\target\surefire-reports for the individual test results.
   [ERROR] -&gt; [Help 1]
   [ERROR]
   [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
   [ERROR] Re-run Maven using the -X switch to enable full debug logging.
   [ERROR]
   [ERROR] For more information about the errors and possible solutions, please read the following articles:
   [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  </code></pre>
  
  <p>I presumably have some of the most simple tests possible (samples created by the maven archetype plugin), and bumping scala by a single minor version is breaking them?  Should I just stick with scala 2.8 until the maven tools catch up?</p>