maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nayan Hajratwala <na...@chikli.com>
Subject Re: Problems with Scala unit testing
Date Mon, 27 Sep 2010 14:12:53 GMT
On Sep 26, 2010, at 3:47 PM, Kenneth McDonald wrote:

> 
> Now for a run of mvn test:
> 
> mvn -X test
> .
> .
> .
> [INFO] Surefire report directory: /Users/Ken/mvn_projects/rex/target/surefire-reports
> 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-/surefirebooter1692256912894030002.jar
/var/folders/J6/J6Md7QzoH-apMu-1gFqvaE+++TM/-Tmp-/surefire9017473591909367701tmp /var/folders/J6/J6Md7QzoH-apMu-1gFqvaE+++TM/-Tmp-/surefire6246108229640345050tmp
> org.apache.maven.surefire.booter.SurefireExecutionException: scala/ScalaObject; nested
exception is java.lang.NoClassDefFoundError: scala/ScalaObject
> java.lang.NoClassDefFoundError: scala/ScalaObject
>        at java.lang.ClassLoader.defineClass1(Native Method)
> .
> .
> .
> 
> The point here is that scala-library is nowhere to be seen. I don't know if maven puts
into one of the tmp directories (that would seem odd), but my guess is that there should be
some mention of scala-library on the command line, but there isn't.

I ran mine with -X as well, and the scala-library does not show up on the classpath, so that's
not your problem.

> 
> And here's my pom.xml file. AFAIK (I'm just learning maven), this should mean that scala-library
is a dependency across all phases:
> 
> <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">
> 

[snip...]

>  <pluginRepositories>
>    <pluginRepository>
>      <id>snapshots.scala-tools.org</id>
>      <name>Scala-Tools Maven2 Repository - Snapshots</name>
>      <url>http://scala-tools.org/repo-snapshots</url>
>    </pluginRepository>
>  </pluginRepositories>

Why are pointing at the snapshot repo for plugins? Since you're new to maven, you may or may
not be aware that SNAPSHOT means the current development release, i.e. trunk. In general,
you'll want to use release versions of third party libraries.

>  <build>
>    <sourceDirectory>src/main/scala</sourceDirectory>
>    <testSourceDirectory>src/test/scala</testSourceDirectory>
>    <plugins>
>        <plugin>
>          <groupId>org.apache.maven.plugins</groupId>
>          <artifactId>maven-dependency-plugin</artifactId>
>          <version>2.1</version>
>        </plugin>
>      <plugin>
>        <groupId>org.scala-tools</groupId>
>        <artifactId>maven-scala-plugin</artifactId>
>        <version>2.14.2-SNAPSHOT</version>

Why are you using the SNAPSHOT versions of the plugins? You should be using the latest release,
which is currently 2.14.1. This *might* be your problem.

>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-surefire-plugin</artifactId>
>        <version>2.6</version>
>        <configuration>
>          <includes>
>            <include>**/*Test.*</include>
>            <include>**/*Suite.*</include>
>          </includes>
>        </configuration>
>      </plugin>
>    </plugins>
>  </build>
>  <reporting>
>    <plugins>
>      <plugin>
>        <groupId>org.scala-tools</groupId>
>        <artifactId>maven-scala-plugin</artifactId>
>        <version>2.14.2-SNAPSHOT</version>
>      </plugin>
>        <plugin>
>          <groupId>org.apache.maven.plugins</groupId>
>          <artifactId>maven-dependency-plugin</artifactId>
>          <version>2.1</version>
>        </plugin>
>    </plugins>

You probably don't need anything in the reporting section.

>  </reporting>
> </project>
> 
> 


---
Nayan Hajratwala
http://agileshrugged.com
http://twitter.com/nhajratw
734.658.6032


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message