This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Still problems with IDEA/maven/scala test phase

No replies
Kenneth McDonald
Joined: 2009-01-11,
User offline. Last seen 42 years 45 weeks ago.

In spite of all the generous help from various people (David Bernard, a special thanks to you), I'm still not getting my maven test phase to run my scalatest tests. I've turned the level of Maven output to "DEBUG" in the console, and have noticed the following:

When I do a 'clean' then a 'compile', the command line that apparently gets run is:

[DEBUG] cmd: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -classpath /Users/Ken/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar:/Users/Ken/.m2/repository/org/scala-lang/scala-compiler/2.8.0/scala-compiler-2.8.0.jar:/Users/Ken/.m2/repository/org/scala-tools/maven-scala-plugin/2.14.2-SNAPSHOT/maven-scala-plugin-2.14.2-SNAPSHOT.jar -Xbootclasspath/a:/Users/Ken/.m2/repository/org/scala-lang/scala-library/2.8.0/scala-library-2.8.0.jar org_scala_tools_maven_executions.MainWithArgsInFile scala.tools.nsc.Main /private/var/folders/J6/J6Md7QzoH-apMu-1gFqvaE+++TM/-Tmp-/scala-maven-1617620453883258206.args

and obviously the scala lib jar is explicitly included on that command line.

On the other hand, when I run the test phase, the command line is:

Forking command line: /bin/sh -c cd /Users/Ken/mvn_projects/rex && /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -jar /var/folders/J6/J6Md7QzoH-apMu-1gFqvaE+++TM/-Tmp-/surefirebooter7143831304197990150.jar /var/folders/J6/J6Md7QzoH-apMu-1gFqvaE+++TM/-Tmp-/surefire3592777617155062334tmp /var/folders/J6/J6Md7QzoH-apMu-1gFqvaE+++TM/-Tmp-/surefire8853558974489588107tmp
org.apache.maven.surefire.booter.SurefireExecutionException: scala/ScalaObject; nested exception is java.lang.NoClassDefFoundError: scala/ScalaObject
java.lang.NoClassDefFoundError: scala/ScalaObject

Here, the scala lib jar is not included on the command line. Is this what's causing my grief? My pom (again, thanks to David) is below. My understanding of maven is that since the scala library dependency is not scoped, it should be available in all maven phases, including test. However, I confess a fair bit of haziness as to how a dependency is mapped to a classpath entry on the command line.

Sorry for not being more proactive about solving this, I'm trying to get it working at the same time as I'm fighting a nasty bug (the biological type) of some sort.

Thanks,
Ken

4.0.0
your.proj.gid
rex
1.0-SNAPSHOT
2010

2.8.0

scala-tools.org
Scala-Tools Maven2 Repository
http://scala-tools.org/repo-releases

snapshots.scala-tools.org
Scala-Tools Maven2 Repository - Snapshots
http://scala-tools.org/repo-snapshots

org.scala-lang
scala-library
${scala.version}

junit
junit
4.8.1
test

org.scalatest
scalatest
1.2
test

src/main/scala
src/test/scala

org.apache.maven.plugins
maven-dependency-plugin
2.1

org.scala-tools
maven-scala-plugin
2.14.2-SNAPSHOT

compile
testCompile

org.apache.maven.plugins
maven-surefire-plugin
2.6

**/*Test.*
**/*Suite.*

org.scala-tools
maven-scala-plugin
2.14.2-SNAPSHOT

org.apache.maven.plugins
maven-dependency-plugin
2.1

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland