How do I use spark-testing-base with Maven? - scala

I would like to find out how to test same spark code. Googling around I have found the spark-tetsting-base. Well, now I would like to try it out but I am not able to run it with Maven.
First, I have scala code which is packable with mvn package and has the following project structure:
pom.xml
src/main/scala/com/test/spark/mycode.scala
src/test/scala/com/test/spark/test.scala
The problem is when I run mvn test it does not run the test under src/main/com/test/spark/test.scala. The test is actually the first example from the spark-testing-base wiki.
The output of maven is:
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # mycode ---
[INFO] Nothing to compile - all classes are up to date
And my pom.xml looks like this:
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.spark</groupId>
<artifactId>mycode</artifactId>
<version>0.0.1</version>
<name>${project.artifactId}</name>
<description>Simple wtest</description>
<inceptionYear>2017</inceptionYear>
<!-- change from 1.6 to 1.7 depending on Java version -->
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.version>2.11.5</scala.version>
<scala.compat.version>2.11</scala.compat.version>
<spark.version>1.6.1</spark.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<!-- Spark dependency -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.compat.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<!-- Spark sql dependency -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.compat.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<!-- Spark hive dependency -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_${scala.compat.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<!-- spark-testing-base dependency -->
<dependency>
<groupId>com.holdenkarau</groupId>
<artifactId>spark-testing-base_2.11</artifactId>
<version>${spark.version}_0.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalactic</groupId>
<artifactId>scalactic_2.11</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>3.2.0-SNAP5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<!-- Create JAR with all dependencies -->
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<scalaCompatVersion>${scala.compat.version}</scalaCompatVersion>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- for testing scala code -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<argLine>-Xmx2048m -XX:MaxPermSize=2048m</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>
Any help appreciated. Thanks!
Edit 1:
I added this as test.scala in order to fail the test:
class test extends FunSuite with SharedSparkContext {
test("test initializing spark context") {
val list = List(1, 2, 3, 4)
val rdd = sc.parallelize(list)
val list2 = List(1, 2, 3, 4, 5)
assert(rdd.count === list2.length)
}
}
But I still get:
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # mycode ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.20:test (default-test) # mycode ---
[INFO]------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]------------------------------------------------------------------------
although the comparison in assert is false as if the test doesn't run. :(
Edit 2:
I changed the pom to with this plugin, still no change:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<includes>
<include>**/*Test.scala</include>
</includes>
<argLine>-Xmx2048m -XX:MaxPermSize=2048m</argLine>
</configuration>
</plugin>
Edit 3:
Added <goal>testCompile</goal> to net.alchim31.maven in order to compile the test class. Altough the test still doesn't run. What is missing to finally get the test to run??
Edit 4:
Thanks for your comments. I changed the pom to the following:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.spark</groupId>
<artifactId>testJavaAndScala</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Test for Java + Scala compilation</name>
<description>Test for Java + Scala compilation</description>
<inceptionYear>2017</inceptionYear>
<properties>
<scala.version>2.11.5</scala.version>
<scala.compat.version>2.11</scala.compat.version>
<spark.version>1.6.1</spark.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<!-- Spark dependency -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.compat.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<!-- Spark sql dependency -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.compat.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<!-- Spark hive dependency -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_${scala.compat.version}</artifactId>
<version>${spark.version}</version>
</dependency>
<!-- Spark-testing-base -->
<dependency>
<groupId>com.holdenkarau</groupId>
<artifactId>spark-testing-base_${scala.compat.version}</artifactId>
<version>${spark.version}_0.6.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
And this is the mvn testoutput:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Test for Java + Scala compilation 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # testJavaAndScala ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/src/main/resources
[INFO]
[INFO] --- scala-maven-plugin:3.2.1:add-source (scala-compile-first) # testJavaAndScala ---
[INFO] Add Source directory: /home/src/main/scala
[INFO] Add Test Source directory: /home/src/test/scala
[INFO]
[INFO] --- scala-maven-plugin:3.2.1:compile (scala-compile-first) # testJavaAndScala ---
[INFO] /home/src/main/scala:-1: info: compiling
[INFO] Compiling 1 source files to /home/target/classes at 1497938635103
[INFO] prepare-compile in 0 s
[INFO] compile in 3 s
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) # testJavaAndScala ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default) # testJavaAndScala ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # testJavaAndScala ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- scala-maven-plugin:3.2.1:testCompile (scala-test-compile) # testJavaAndScala ---
[INFO] /home/src/test/scala:-1: info: compiling
[INFO] Compiling 1 source files to /home/target/test-classes at 1497938639022
[INFO] prepare-compile in 0 s
[INFO] compile in 5 s
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) # testJavaAndScala ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # testJavaAndScala ---
[INFO] Surefire report directory: /home/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.854 s
[INFO] Finished at: 2017-06-20T08:04:05+02:00
[INFO] Final Memory: 28M/360M
[INFO] ------------------------------------------------------------------------
I can find my test class in the target directory but it seems it is not executed. Why is that? As I said it is just the minimal exmaple and it does not rely on my actual main code.

Surefire wont find those scalatest tests on it's own. You need to use the scalatest-maven-plugin. Instructions are available on their website
To get started, modify your pom like this.
<!-- disable surefire -- >
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- enable scalatest -- >
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>

The test cannot be run due to the folder structure.
Your folder structure
src/main/scala/com/test/spark/mycode.scala
src/main/test/com/test/spark/test.scala
Folder structure should be like
src/main/scala/com/test/spark/mycode.scala
src/test/scala/com/test/spark/test.scala
Here is the standard maven layout.
Hope this helps!
Edited
you are missing test execution plugin in your pom file please see scala maven plugin
please add the following in your net.alchim31.maven plugin part
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>

Even though this is a very late reply, but I wrote it hoping that someone might get benefitted from it in case their scala unit test are not getting discovered. One of the major and silent culprit is the absolute path to the test classes. If there is a space in the name of any directory on the path, scalatest won't pick it up. Rename such directories for successful running of unit tests. Also in your case, you might want to add the sacalatest maven plugin after disabling the surefire plugin.

Related

error: java.lang.NoSuchMethodError: 'scala.tools.nsc.reporters.Reporter scala.tools.nsc.Global.reporter()' in scoverage-maven-plugin

I am trying to get some reports with the code coverage information for my project. I found that scoverage-maven-plugin produce xml files covering the % of the different modules that the unit test cases have covered so far.
So I tried to add that plugin in my pom, but I am getting the following error:
[ERROR] error: java.lang.NoSuchMethodError: 'scala.tools.nsc.reporters.Reporter scala.tools.nsc.Global.reporter()'
[INFO] at scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:115)
[INFO] at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1514)
[INFO] at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1498)
[INFO] at scala.tools.nsc.Global$Run.compileSources(Global.scala:1491)
[INFO] at scala.tools.nsc.Global$Run.compile(Global.scala:1620)
[INFO] at scala.tools.nsc.Driver.doCompile(Driver.scala:47)
[INFO] at scala.tools.nsc.MainClass.doCompile(Main.scala:32)
[INFO] at scala.tools.nsc.Driver.process(Driver.scala:67)
[INFO] at scala.tools.nsc.Driver.main(Driver.scala:80)
[INFO] at scala.tools.nsc.Main.main(Main.scala)
[INFO] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
[INFO] at java.base/java.lang.reflect.Method.invoke(Method.java:577)
[INFO] at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
[INFO] at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
[INFO] java.lang.reflect.InvocationTargetException
[INFO] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
[INFO] at java.base/java.lang.reflect.Method.invoke(Method.java:577)
[INFO] at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
[INFO] at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
[ERROR] Caused by: java.lang.NoSuchMethodError: 'scala.tools.nsc.reporters.Reporter scala.tools.nsc.Global.reporter()'
[INFO] at scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:115)
[INFO] at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1514)
[INFO] at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1498)
[INFO] at scala.tools.nsc.Global$Run.compileSources(Global.scala:1491)
[INFO] at scala.tools.nsc.Global$Run.compile(Global.scala:1620)
[INFO] at scala.tools.nsc.Driver.doCompile(Driver.scala:47)
[INFO] at scala.tools.nsc.MainClass.doCompile(Main.scala:32)
[INFO] at scala.tools.nsc.Driver.process(Driver.scala:67)
[INFO] at scala.tools.nsc.Driver.main(Driver.scala:80)
[INFO] at scala.tools.nsc.Main.main(Main.scala)
[INFO] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
[INFO] ... 3 more
Not able to find from where I should get scala.tools.nsc.reporters.Reporter scala.tools.nsc.Global.reporter()
The full pom is:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupid</groupId>
<artifactId>myartifact</artifactId>
<version>1.0.0</version>
<name>myproject</name>
<properties>
<app.build.version>1.0.0</app.build.version>
<encoding>UTF-8</encoding>
<scala.version>2.12.14</scala.version>
<scala.compat.version>2.12</scala.compat.version>
<scala.binary.version>2.12</scala.binary.version>
<spark.version>3.2.1</spark.version>
<scope.value>provided</scope.value>
<scoverage.plugin.version>1.3.0</scoverage.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.binary.version}</artifactId>
<version>${spark.version}</version>
<scope>${scope.value}</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.binary.version}</artifactId>
<version>${spark.version}</version>
<scope>${scope.value}</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_${scala.binary.version}</artifactId>
<version>${spark.version}</version>
<scope>${scope.value}</scope>
</dependency>
<dependency>
<groupId>io.delta</groupId>
<artifactId>delta-core_2.12</artifactId>
<version>2.0.0</version>
<scope>${scope.value}</scope>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-streams</artifactId>
<version>3.1.2</version>
<scope>${scope.value}</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql-kafka-0-10_${scala.binary.version}</artifactId>
<version>${spark.version}</version>
<scope>${scope.value}</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.12</artifactId>
<version>3.2.14</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>myproject-${app.build.version}</finalName>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scoverage</groupId>
<artifactId>scoverage-maven-plugin</artifactId>
<version>${scoverage.plugin.version}</version>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<highlighting>true</highlighting>
<aggregate>true</aggregate>
</configuration>
<executions>
<execution>
<goals>
<goal>report</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<id>Scaladoc</id>
<goals>
<goal>doc</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<args>
<arg>-no-link-warnings</arg>
</args>
</configuration>
</execution>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>doc-jar</goal>
</goals>
</execution>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
<jvmArgs>
<jvmArg>-Xss4m</jvmArg>
<jvmArg>-Xms512m</jvmArg>
<jvmArg>-Xmx4096m</jvmArg>
</jvmArgs>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
<htmlreporters>${project.build.directory}/html/scalatest</htmlreporters>
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Edits after #Dmytro feedback:
I added in the pom the following dependencies:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scoverage</groupId>
<artifactId>scalac-scoverage-plugin_2.12</artifactId>
<version>1.4.1</version>
</dependency>
And changed the scope to
<scope.value>compile</scope.value>
But I am still getting the error: java.lang.NoSuchMethodError: 'scala.tools.nsc.reporters.Reporter scala.tools.nsc.Global.reporter()'
Could you try to add
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<!--<version>2.12.14</version>-->
<version>${scala.version}</version>
</dependency>
?
https://mvnrepository.com/artifact/org.scala-lang/scala-compiler
Does this change anything for you?
scoverage-maven-plugin 1.3.0 depends on scalac-scoverage-plugin 1.3.0
https://github.com/scoverage/scoverage-maven-plugin/blob/scoverage-maven-plugin-1.3.0/pom.xml#L93-L101
scalac-scoverage-plugin 1.3.0 depends on scala-compiler 2.12.0
https://index.scala-lang.org/scoverage/scalac-scoverage-plugin/artifacts/scalac-scoverage-plugin/1.3.0
https://github.com/scoverage/scalac-scoverage-plugin/blob/v1.3.0/build.sbt#L89
https://github.com/scoverage/scalac-scoverage-plugin/blob/v1.3.0/build.sbt#L15
scala-compiler is marked as provided in the dependencies of scalac-scoverage-plugin so should be added manually when needed.
The method scala.tools.nsc.Global.reporter() returns Reporter in scala-compiler 2.12.0 https://github.com/scala/scala/blob/v2.12.0/src/compiler/scala/tools/nsc/Global.scala#L1581 (it seems in 2.12.0 there is no scala.tools.nsc.Global.reporter(), it appears in 2.12.5). In 2.12.14 the signature is different, the method returns FilteringReporter https://github.com/scala/scala/blob/v2.12.14/src/compiler/scala/tools/nsc/Global.scala#L1748 https://github.com/scala/scala/blob/v2.12.14/src/compiler/scala/tools/nsc/Global.scala#L90 So the issue seems to be in the combination of versions scalac-scoverage-plugin 1.3.0 + scala-compiler 2.12.14.
Try to either upgrade scoverage-plugin or downgrade Scala version so that the signature of the method is the same (returning either Reporter both times or FilteringReporter both times). The signature changed in 2.12.12 -> 2.12.13 (Reporter -> FilteringReporter) https://github.com/scala/scala/blob/v2.12.12/src/compiler/scala/tools/nsc/Global.scala#L90 https://github.com/scala/scala/blob/v2.12.13/src/compiler/scala/tools/nsc/Global.scala#L90 If you're on scoverage-plugin 1.4.1 can you change Scala to 2.12.12?
Try then to downgrade the scala version:
<properties>
<scala.version>2.12.12</scala.version>
...
</properties>
in combination with
<dependency>
<groupId>org.scoverage</groupId>
<artifactId>scalac-scoverage-plugin_2.12</artifactId>
<version>1.4.1</version>
</dependency>

Could not resolve dependencies in scala

I'm having a real hard time resolving this error.
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.bosch.us.dm.test:isbn-encoder >------------------
[INFO] Building isbn-encoder 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/spark/spark-core_2.1/2.1.1/spark-core_2.1-2.1.1.pom
[WARNING] The POM for org.apache.spark:spark-core_2.1:jar:2.1.1 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/spark/spark-sql_2.1/2.1.1/spark-sql_2.1-2.1.1.pom
[WARNING] The POM for org.apache.spark:spark-sql_2.1:jar:2.1.1 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/spark/spark-core_2.1/2.1.1/spark-core_2.1-2.1.1.jar
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/spark/spark-sql_2.1/2.1.1/spark-sql_2.1-2.1.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.081 s
[INFO] Finished at: 2021-04-17T20:22:31-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project isbn-encoder: Could not resolve dependencies for project com.bosch.us.dm.test:isbn-encoder:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.apache.spark:spark-core_2.1:jar:2.1.1, org.apache.spark:spark-sql_2.1:jar:2.1.1: Could not find artifact org.apache.spark:spark-core_2.1:jar:2.1.1 in central (https://repo.maven.apache.org/maven2) -> [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/DependencyResolutionException
I'm using maven to compile. I've tried changing scala maven plugin version but that doesn't seem to help. I don't understand the pom.xml file very well so it could very well be the source of my problem. The pom.xml looks like this
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bosch.us.dm.test</groupId>
<artifactId>isbn-encoder</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<spark.version>2.1.1</spark.version>
<scala.dep.version>2.1</scala.dep.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_${scala.dep.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.dep.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- mixed scala/java compile -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.3</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>testCompile</goal>
</goals>
<phase>test-compile</phase>
</execution>
<execution>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I've read some sources suggesting to delete jar files but I'm not sure where those would be located.

Could not resolve dependencies, Failure to find jar

I'm trying to run vaadin-charts-demo.
Similar issue to this:
Maven Could not resolve dependencies, artifacts could not be resolved
[INFO] <<< vaadin-maven-plugin:7.4.6:compile (default-cli) < process-resources # vaadin-charts-demo <<<
[WARNING] The POM for com.vaadin.demo:vaadin-charts-examples:jar:3.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.414 s
[INFO] Finished at: 2015-07-09T20:57:33-05:00
[INFO] Final Memory: 12M/225M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project vaadin-charts-demo: Could not resolve dependencies for project com.vaadin.demo:vaadin-charts-demo:war:3.0-SNAPSHOT: Failure to find com.vaadin.demo:vaadin-charts-examples:jar:3.0-SNAPSHOT in https://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-addons has elapsed or updates are forced -> [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/DependencyResolutionException
pom.xml content:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<groupId>com.vaadin.addon</groupId>
<artifactId>vaadin-charts-parent</artifactId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.vaadin.demo</groupId>
<artifactId>vaadin-charts-demo</artifactId>
<packaging>war</packaging>
<name>Vaadin Charts Demo</name>
<dependencies>
<dependency>
<groupId>com.vaadin.addon</groupId>
<artifactId>vaadin-charts</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin.demo</groupId>
<artifactId>vaadin-charts-examples</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Vaadin -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>8.1.13.v20130916</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>googleanalyticstracker</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>7.6.0.alpha2</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/config.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/config.properties</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<packagingExcludes>**/gwt-unitCache/*,**/widgetsets/WEB-INF/**/*</packagingExcludes>
</configuration>
</plugin>
<!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
<!-- directory is cleaned properly -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/webapp/VAADIN/widgetsets</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<configuration>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<!-- We are doing "inplace" but into subdir VAADIN/widgetsets.
This way compatible with Vaadin eclipse plugin. -->
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets
</webappDirectory>
<hostedWebapp>${basedir}/target/ignore/VAADIN/widgetsets
</hostedWebapp>
<noServer>true</noServer>
<!-- Remove draftCompile when project is ready -->
<draftCompile>false</draftCompile>
<compileReport>true</compileReport>
<!-- <style>PRETTY</style> -->
<strict>true</strict>
<runTarget>http://localhost:8080/</runTarget>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
</goals>
</execution>
<execution>
<id>compile-widgetset-on-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Tried googling vaadin-chart-examples and chart-demos maven, repository, etc., but haven't found a solution. How can this be resolved?
[[edit]]
The project is imported from here:
https://github.com/vaadin/charts/tree/7a55e8dab5b9941a05603c2624a576866e86045d
Following these instructions:
https://github.com/vaadin/charts/blob/7a55e8dab5b9941a05603c2624a576866e86045d/DevInstructions.md
After install, couldn't compile widgets
The instructions are for Luna, I'm using Mars, not sure how that affects things.
Did you try adding this repository for Vaadin add-ons:
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
If you built just vaadin-charts-demo so far build vaadin-charts-parent before, as well.
The parent includes vaadin-charts-examples as <module>. So, if you don't build parent (or examples explicitely) at least once, none of the modules' artifacts is available in your Eclipse workspace and your local Maven repo to be resolved from there.
Remember, Aggregation and Inheritance are different types of POM Relationships.
For resolving dependencies from your Eclipse workspace see <Your Eclipse Maven project> → Properties → Maven → [✔] Resolve dependencies from Workspace projects.

compiler errors when starting gwt:compile with gwt-maven-plugin

I'm trying to migrating a gwt-project to maven for a couple of days, but keep running into problems.
I tried to follow different guides and tried different pom-configurations but didn't get it to work.
At the moment, it's like this:
When I run gwt:compile, I get [ERROR] Line 8: The import de.bml.web.versandanzeige.server.model.Zyklus cannot be resolved, which is just one of many classes in my package. The error shows only up for this class. I'll post complete log below
the complete error log, with -e option:
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Versandanzeige_Web 1.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- gwt-maven-plugin:2.5.0:compile (default-cli) # Versandanzeige_Web ---
[INFO] Compiling module de.bml.web.versandanzeige.Versandanzeige_Web
[INFO] Validating units:
[INFO] Ignored 3 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO] Computing all possible rebind results for 'de.bml.web.versandanzeige.client.services.KostenstelleService'
[INFO] Rebinding de.bml.web.versandanzeige.client.services.KostenstelleService
[INFO] Checking rule <generate-with class='com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator'/>
[INFO] [ERROR] Errors in 'file:/home/icarus/git/BML-connect/Versandanzeige_Web/src/main/java/de/bml/web/versandanzeige/client/dto/ZyklusDTO.java'
[INFO] [ERROR] Line 8: The import de.bml.web.versandanzeige.server.model.Zyklus cannot be resolved
[INFO] [ERROR] Line 74: Zyklus cannot be resolved
[INFO] [ERROR] Line 77: Zyklus cannot be resolved
[INFO] [ERROR] Line 80: Zyklus cannot be resolved
[INFO] [ERROR] Line 83: Zyklus cannot be resolved
[INFO] [ERROR] Line 86: Zyklus cannot be resolved
[INFO] [ERROR] Unable to find type 'de.bml.web.versandanzeige.client.services.KostenstelleService'
[INFO] [ERROR] Hint: Previous compiler errors may have made this type unavailable
[INFO] [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
... all places where Zyklus is used follow ...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.406s
[INFO] Finished at: Mon Nov 12 15:27:39 CET 2012
[INFO] Final Memory: 13M/168M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.5.0:compile (default-cli) on project Versandanzeige_Web: Command [[
[ERROR] /bin/sh -c /usr/java/jdk1.7.0_07/jre/bin/java -Xmx512m -classpath /home/icarus/git/BML-connect/Versandanzeige_Web/src/main/webapp/WEB-INF/classes:/home/icarus/git/BML-connect/Versandanzeige_Web/src/main/java:/home/icarus/git/BML-connect/Versandanzeige_Web/src/main/resources:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-plugin-api/3.2/sonar-plugin-api-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-check-api/3.2/sonar-check-api-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-colorizer/3.2/sonar-colorizer-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-channel/3.2/sonar-channel-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-duplications/3.2/sonar-duplications-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-graph/3.2/sonar-graph-3.2.jar:/home/icarus/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-squid/3.2/sonar-squid-3.2.jar:/home/icarus/.m2/repository/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar:/home/icarus/.m2/repository/org/picocontainer/picocontainer/2.14.1/picocontainer-2.14.1.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-commons-annotations/3.1.0.GA/hibernate-commons-annotations-3.1.0.GA.jar:/home/icarus/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar:/home/icarus/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/home/icarus/.m2/repository/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar:/home/icarus/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/icarus/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/home/icarus/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/home/icarus/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/home/icarus/.m2/repository/jfree/jfreechart/1.0.9/jfreechart-1.0.9.jar:/home/icarus/.m2/repository/jfree/jcommon/1.0.12/jcommon-1.0.12.jar:/home/icarus/.m2/repository/org/slf4j/slf4j-api/1.6.2/slf4j-api-1.6.2.jar:/home/icarus/.m2/repository/org/slf4j/jcl-over-slf4j/1.6.2/jcl-over-slf4j-1.6.2.jar:/home/icarus/.m2/repository/org/slf4j/log4j-over-slf4j/1.6.2/log4j-over-slf4j-1.6.2.jar:/home/icarus/.m2/repository/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar:/home/icarus/.m2/repository/xpp3/xpp3/1.1.3.3/xpp3-1.1.3.3.jar:/home/icarus/.m2/repository/org/codehaus/woodstox/woodstox-core-lgpl/4.0.4/woodstox-core-lgpl-4.0.4.jar:/home/icarus/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/home/icarus/.m2/repository/org/codehaus/woodstox/stax2-api/3.0.1/stax2-api-3.0.1.jar:/home/icarus/.m2/repository/org/codehaus/staxmate/staxmate/2.0.0/staxmate-2.0.0.jar:/home/icarus/.m2/repository/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar:/home/icarus/.m2/repository/xalan/xalan/2.7.1/xalan-2.7.1.jar:/home/icarus/.m2/repository/xalan/serializer/2.7.1/serializer-2.7.1.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-gwt-api/2.11/sonar-gwt-api-2.11.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-ws-client/2.11/sonar-ws-client-2.11.jar:/home/icarus/.m2/repository/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-incubator/2.0.1/gwt-incubator-2.0.1.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar:/home/icarus/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA.jar:/home/icarus/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA-sources.jar:/home/icarus/.m2/repository/org/json/json/20090211/json-20090211.jar:/home/icarus/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-entitymanager/3.5.3-Final/hibernate-entitymanager-3.5.3-Final.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-core/3.5.3-Final/hibernate-core-3.5.3-Final.jar:/home/icarus/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar:/home/icarus/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/home/icarus/.m2/repository/cglib/cglib/2.2/cglib-2.2.jar:/home/icarus/.m2/repository/asm/asm/3.1/asm-3.1.jar:/home/icarus/.m2/repository/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar:/home/icarus/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar:/home/icarus/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1/geronimo-jta_1.1_spec-1.1.jar:/home/icarus/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar:/home/icarus/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/home/icarus/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-dev/2.5.0/gwt-dev-2.5.0.jar com.google.gwt.dev.Compiler -logLevel INFO -style PRETTY -war /home/icarus/git/BML-connect/Versandanzeige_Web/src/main/webapp -localWorkers 4 -XfragmentCount -1 -gen /home/icarus/git/BML-connect/Versandanzeige_Web/target/.generated de.bml.web.versandanzeige.Versandanzeige_Web
[ERROR] ]] failed with status 1
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.5.0:compile (default-cli) on project Versandanzeige_Web: Command [[
/bin/sh -c /usr/java/jdk1.7.0_07/jre/bin/java -Xmx512m -classpath /home/icarus/git/BML-connect/Versandanzeige_Web/src/main/webapp/WEB-INF/classes:/home/icarus/git/BML-connect/Versandanzeige_Web/src/main/java:/home/icarus/git/BML-connect/Versandanzeige_Web/src/main/resources:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-plugin-api/3.2/sonar-plugin-api-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-check-api/3.2/sonar-check-api-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-colorizer/3.2/sonar-colorizer-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-channel/3.2/sonar-channel-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-duplications/3.2/sonar-duplications-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-graph/3.2/sonar-graph-3.2.jar:/home/icarus/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-squid/3.2/sonar-squid-3.2.jar:/home/icarus/.m2/repository/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar:/home/icarus/.m2/repository/org/picocontainer/picocontainer/2.14.1/picocontainer-2.14.1.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-commons-annotations/3.1.0.GA/hibernate-commons-annotations-3.1.0.GA.jar:/home/icarus/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar:/home/icarus/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/home/icarus/.m2/repository/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar:/home/icarus/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/icarus/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/home/icarus/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/home/icarus/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/home/icarus/.m2/repository/jfree/jfreechart/1.0.9/jfreechart-1.0.9.jar:/home/icarus/.m2/repository/jfree/jcommon/1.0.12/jcommon-1.0.12.jar:/home/icarus/.m2/repository/org/slf4j/slf4j-api/1.6.2/slf4j-api-1.6.2.jar:/home/icarus/.m2/repository/org/slf4j/jcl-over-slf4j/1.6.2/jcl-over-slf4j-1.6.2.jar:/home/icarus/.m2/repository/org/slf4j/log4j-over-slf4j/1.6.2/log4j-over-slf4j-1.6.2.jar:/home/icarus/.m2/repository/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar:/home/icarus/.m2/repository/xpp3/xpp3/1.1.3.3/xpp3-1.1.3.3.jar:/home/icarus/.m2/repository/org/codehaus/woodstox/woodstox-core-lgpl/4.0.4/woodstox-core-lgpl-4.0.4.jar:/home/icarus/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/home/icarus/.m2/repository/org/codehaus/woodstox/stax2-api/3.0.1/stax2-api-3.0.1.jar:/home/icarus/.m2/repository/org/codehaus/staxmate/staxmate/2.0.0/staxmate-2.0.0.jar:/home/icarus/.m2/repository/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar:/home/icarus/.m2/repository/xalan/xalan/2.7.1/xalan-2.7.1.jar:/home/icarus/.m2/repository/xalan/serializer/2.7.1/serializer-2.7.1.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-gwt-api/2.11/sonar-gwt-api-2.11.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-ws-client/2.11/sonar-ws-client-2.11.jar:/home/icarus/.m2/repository/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-incubator/2.0.1/gwt-incubator-2.0.1.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar:/home/icarus/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA.jar:/home/icarus/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA-sources.jar:/home/icarus/.m2/repository/org/json/json/20090211/json-20090211.jar:/home/icarus/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-entitymanager/3.5.3-Final/hibernate-entitymanager-3.5.3-Final.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-core/3.5.3-Final/hibernate-core-3.5.3-Final.jar:/home/icarus/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar:/home/icarus/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/home/icarus/.m2/repository/cglib/cglib/2.2/cglib-2.2.jar:/home/icarus/.m2/repository/asm/asm/3.1/asm-3.1.jar:/home/icarus/.m2/repository/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar:/home/icarus/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar:/home/icarus/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1/geronimo-jta_1.1_spec-1.1.jar:/home/icarus/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar:/home/icarus/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/home/icarus/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-dev/2.5.0/gwt-dev-2.5.0.jar com.google.gwt.dev.Compiler -logLevel INFO -style PRETTY -war /home/icarus/git/BML-connect/Versandanzeige_Web/src/main/webapp -localWorkers 4 -XfragmentCount -1 -gen /home/icarus/git/BML-connect/Versandanzeige_Web/target/.generated de.bml.web.versandanzeige.Versandanzeige_Web
]] failed with status 1
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:158)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.codehaus.mojo.gwt.shell.ForkedProcessExecutionException: Command [[
/bin/sh -c /usr/java/jdk1.7.0_07/jre/bin/java -Xmx512m -classpath /home/icarus/git/BML-connect/Versandanzeige_Web/src/main/webapp/WEB-INF/classes:/home/icarus/git/BML-connect/Versandanzeige_Web/src/main/java:/home/icarus/git/BML-connect/Versandanzeige_Web/src/main/resources:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-plugin-api/3.2/sonar-plugin-api-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-check-api/3.2/sonar-check-api-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-colorizer/3.2/sonar-colorizer-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-channel/3.2/sonar-channel-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-duplications/3.2/sonar-duplications-3.2.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-graph/3.2/sonar-graph-3.2.jar:/home/icarus/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-squid/3.2/sonar-squid-3.2.jar:/home/icarus/.m2/repository/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar:/home/icarus/.m2/repository/org/picocontainer/picocontainer/2.14.1/picocontainer-2.14.1.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-commons-annotations/3.1.0.GA/hibernate-commons-annotations-3.1.0.GA.jar:/home/icarus/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar:/home/icarus/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/home/icarus/.m2/repository/commons-configuration/commons-configuration/1.6/commons-configuration-1.6.jar:/home/icarus/.m2/repository/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar:/home/icarus/.m2/repository/commons-digester/commons-digester/1.8/commons-digester-1.8.jar:/home/icarus/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar:/home/icarus/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/home/icarus/.m2/repository/jfree/jfreechart/1.0.9/jfreechart-1.0.9.jar:/home/icarus/.m2/repository/jfree/jcommon/1.0.12/jcommon-1.0.12.jar:/home/icarus/.m2/repository/org/slf4j/slf4j-api/1.6.2/slf4j-api-1.6.2.jar:/home/icarus/.m2/repository/org/slf4j/jcl-over-slf4j/1.6.2/jcl-over-slf4j-1.6.2.jar:/home/icarus/.m2/repository/org/slf4j/log4j-over-slf4j/1.6.2/log4j-over-slf4j-1.6.2.jar:/home/icarus/.m2/repository/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar:/home/icarus/.m2/repository/xpp3/xpp3/1.1.3.3/xpp3-1.1.3.3.jar:/home/icarus/.m2/repository/org/codehaus/woodstox/woodstox-core-lgpl/4.0.4/woodstox-core-lgpl-4.0.4.jar:/home/icarus/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/home/icarus/.m2/repository/org/codehaus/woodstox/stax2-api/3.0.1/stax2-api-3.0.1.jar:/home/icarus/.m2/repository/org/codehaus/staxmate/staxmate/2.0.0/staxmate-2.0.0.jar:/home/icarus/.m2/repository/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar:/home/icarus/.m2/repository/xalan/xalan/2.7.1/xalan-2.7.1.jar:/home/icarus/.m2/repository/xalan/serializer/2.7.1/serializer-2.7.1.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-gwt-api/2.11/sonar-gwt-api-2.11.jar:/home/icarus/.m2/repository/org/codehaus/sonar/sonar-ws-client/2.11/sonar-ws-client-2.11.jar:/home/icarus/.m2/repository/com/googlecode/json-simple/json-simple/1.1/json-simple-1.1.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-incubator/2.0.1/gwt-incubator-2.0.1.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar:/home/icarus/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA.jar:/home/icarus/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA-sources.jar:/home/icarus/.m2/repository/org/json/json/20090211/json-20090211.jar:/home/icarus/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-entitymanager/3.5.3-Final/hibernate-entitymanager-3.5.3-Final.jar:/home/icarus/.m2/repository/org/hibernate/hibernate-core/3.5.3-Final/hibernate-core-3.5.3-Final.jar:/home/icarus/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar:/home/icarus/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/home/icarus/.m2/repository/cglib/cglib/2.2/cglib-2.2.jar:/home/icarus/.m2/repository/asm/asm/3.1/asm-3.1.jar:/home/icarus/.m2/repository/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar:/home/icarus/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar:/home/icarus/.m2/repository/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1/geronimo-jta_1.1_spec-1.1.jar:/home/icarus/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar:/home/icarus/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/home/icarus/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-user/2.5.0/gwt-user-2.5.0.jar:/home/icarus/.m2/repository/com/google/gwt/gwt-dev/2.5.0/gwt-dev-2.5.0.jar com.google.gwt.dev.Compiler -logLevel INFO -style PRETTY -war /home/icarus/git/BML-connect/Versandanzeige_Web/src/main/webapp -localWorkers 4 -XfragmentCount -1 -gen /home/icarus/git/BML-connect/Versandanzeige_Web/target/.generated de.bml.web.versandanzeige.Versandanzeige_Web
]] failed with status 1
at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo$JavaCommand.execute(AbstractGwtShellMojo.java:485)
at org.codehaus.mojo.gwt.shell.CompileMojo.compile(CompileMojo.java:365)
at org.codehaus.mojo.gwt.shell.CompileMojo.doExecute(CompileMojo.java:280)
at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:172)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
[ERROR]
[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/MojoExecutionException
my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<!-- for gwt-incubator -->
<id>sonar</id>
<name>Sonar</name>
<url>http://repository.sonarsource.org/content/repositories/sonar</url>
<releases>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>3.2</version>
<exclusions>
<exclusion>
<artifactId>ejb3-persistence</artifactId>
<groupId>org.hibernate</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-gwt-api</artifactId>
<version>2.11</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.5.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.5.0</version>
<scope>provided</scope>
</dependency>
<!-- unit tests -->
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-testing-harness</artifactId>
<version>2.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.3-Final</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jta_1.1_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<groupId>de.bml-con</groupId>
<artifactId>Versandanzeige_Web</artifactId>
<packaging>war</packaging>
<version>1.0.2-SNAPSHOT</version>
<build>
<outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webappDirectory>src/main/webapp</webappDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<webAppConfig>
<contextPath>/${project.name}</contextPath>
</webAppConfig>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<logLevel>INFO</logLevel>
<style>PRETTY</style>
<gwtVersion>2.1.0</gwtVersion>
<runTarget>de.bml.web.versandanzeige.Versandanzeige_Web/Versandanzeige_Web.html
</runTarget>
<modules>
<module>de.bml.web.versandanzeige.Versandanzeige_Web</module>
</modules>
<copyWebapp>true</copyWebapp>
<webappDirectory>src/main/webapp</webappDirectory>
</configuration>
<executions>
<execution>
<id>gwtcompile</id>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- manage dependencies -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<includeTypes>jar</includeTypes>
<stripVersion>true</stripVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<executions>
<execution>
<id>copy-deps</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<projectsDirectory>.</projectsDirectory>
<pomIncludes>
<pomInclude>pom.xml</pomInclude>
</pomIncludes>
<streamLogs>true</streamLogs>
<goals>
<goal>dependency:copy-dependencies</goal>
</goals>
<encoding>UTF-8</encoding>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
project structure:
sources:
webapp:
This project is already under version control, so I'd try to avoid starting anew.
How can I fix this problem, make it compile into a war and start in debug mode?
GWT 101: client code cannot refer to server code.
More specifically:
[INFO] [ERROR] Errors in 'file:/home/icarus/git/BML-connect/Versandanzeige_Web/src/main/java/de/bml/web/versandanzeige/client/dto/ZyklusDTO.java'
[INFO] [ERROR] Line 8: The import de.bml.web.versandanzeige.server.model.Zyklus cannot be resolved
and the server subpackage probably has no corresponding <source path="server" /> in your de/bml/web/versandanzeige/Versandanzeige_Web.gwt.xml (totally understandable though). See https://developers.google.com/web-toolkit/doc/latest/DevGuideOrganizingProjects#DevGuideDirectoriesPackageConventions and https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsClient
Is your gwt module description missing ( xxx.gwt.xml) ?

Trying to get ScalaTest working: "There are no tests to run" when doing "mvn test"

Edit: I finally got it to work!!!
It needed a combination of JUnit in the pom.xml, and three statements in my .scala:
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
#RunWith(classOf[JUnitRunner])
For some reason, trying to configure Surefire makes the tests stop running again.
I'm coding in IntelliJ, trying to get a simple ScalaTest test running via a Maven (mvn test) build process. There aren't any errors, but unfortunately no tests run either.
Here is my .scala file:
import org.scalatest.FunSuite
import org.scalatest.BeforeAndAfter
class ExampleSuite extends FunSuite with BeforeAndAfter {
before {
println("Doing setup tasks...")
}
test("Example test of checking the browser title") {
val expected_title = "Company Platform"
var actual_title = "Company Platform"
assert(actual_title == expected_title)
}
after {
println("Doing teardown tasks...")
}
}
Here's the Maven output:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for JoeTestDemo:JoeTestDemo:jar:1.0
[WARNING] 'build.plugins.plugin.version' for org.scala-tools:maven-scala-plugin is missing. # line 42, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building JoeTestDemo 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) # JoeTestDemo ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # JoeTestDemo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:compile (default) # JoeTestDemo ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[WARNING] No source files found.
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) # JoeTestDemo ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Joeshaver/Projects/JoeTestDemo/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # JoeTestDemo ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:testCompile (default) # JoeTestDemo ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) # JoeTestDemo ---
[INFO] Surefire report directory: /Users/Joeshaver/Projects/JoeTestDemo/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.368s
[INFO] Finished at: Tue Oct 23 10:58:30 PDT 2012
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
Here is the pom.xml. I think my Maven Scala plugin might not be right:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>JoeTestDemo</groupId>
<artifactId>JoeTestDemo</artifactId>
<version>1.0</version>
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.9.0-1</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.0-1</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceDir>src/main/java</sourceDir>
<jvmArgs>
<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
You might want to use the scalatest-maven-plugin to run your scala tests.
Also make sure that you use the <scope>test</scope> for jars needed only for test purposes.
This is how I have defined my pom.xml for using ScalaTest:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.stackoverflow</groupId>
<artifactId>Q13036561</artifactId>
<version>1.0-SNAPSHOT</version>
<name>${project.artifactId}-${project.version}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.9.2</scala.version>
<scalatest.version>2.0.M4</scalatest.version>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.version}</artifactId>
<version>${scalatest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<args>
<arg>-make:transitive</arg>
<arg>-dependencyfile</arg>
<arg>${project.build.directory}/.scala_dependencies</arg>
</args>
</configuration>
</execution>
</executions>
</plugin>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<executions>
<execution>
<id>default-test</id>
< ! - Disable the default-test by putting it in phase none - >
<phase>none</phase>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0-M2</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<stdout>W</stdout> <!-- Skip coloring output -->
</configuration>
<executions>
<execution>
<id>scala-test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
As you can see I have also added a section that disables the surefire plugin if you really don't want to run it. It is commented in the above pom but if you want to disable the surefire plugin just uncomment that part.
I am using IntelliJ too and there are no problems at all with this combination. Just run the tests from within IntelliJ or by using mvn test, they will both work.
If you're running on Maven, then you'll either have to annotate your test class(es) with
#RunWith(classOf[JUnitRunner])
This would require you having JUnit as a dependency. Or you could use the ScalaTest Maven Plugin (haven't used it myself though).
Adding to Blake's answer, besides #RunWith(classOf[JUnitRunner]) you might also need to set the surefire as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<includes>
<include>**/*Suite.class</include>
<include>**/*Test.class</include>
<include>**/*Tests.class</include>
<include>**/*Spec.class</include>
<include>**/*Specs.class</include>
</includes>
</configuration>
</plugin>
Here's one of my Maven projects which tests just fine by ScalaTest without any special plugin: https://github.com/nikita-volkov/sext/