gwt-plugin compile-error with JDK-17: Unable to make private final sun.util.calendar.BaseCalendar$Date java.util.Date.getCalendarDate() accessible - gwt

I try to upgrade my large java-application from jdk-11 to jdk-17. On jdk-11 all is ok.
We use the following gwt-plugin (version 1.0.1) to compile:
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<moduleName>xxxxxxxxxxxxx</moduleName>
<jvmArgs>
<jvmArg>-showversion</jvmArg>
<jvmArg>-Xmx2048M</jvmArg>
</jvmArgs>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
but the compile complains with:
[INFO] --- gwt-maven-plugin:1.0.1:compile (default-cli) # xxxxxxx ---
[WARNING] openjdk version "17.0.2" 2022-01-18 LTS
[WARNING] OpenJDK Runtime Environment Zulu17.32+13-CA (build 17.0.2+8-LTS)
[WARNING] OpenJDK 64-Bit Server VM Zulu17.32+13-CA (build 17.0.2+8-LTS, mixed mode, sharing)
[INFO] Compiling module xxxxxxxx
...
[INFO] java.lang.reflect.InaccessibleObjectException: Unable to make private final sun.util.calendar.BaseCalendar$Date java.util.Date.getCalendarDate() accessible: module java.base does not "opens java.util" to unnamed module #145f66e3
[INFO] at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
[INFO] at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
[INFO] at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
[INFO] at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
[INFO] at org.hibernate.validator.util.privilegedactions.SetAccessibility.run(SetAccessibility.java:39)
[INFO] at org.hibernate.validator.util.ReflectionHelper.setAccessibility(ReflectionHelper.java:354)
[INFO] at org.hibernate.validator.metadata.BeanMetaDataImpl.addMethodMetaConstraint(BeanMetaDataImpl.java:474)
[INFO] at org.hibernate.validator.metadata.BeanMetaDataImpl.initMethodConstraints(BeanMetaDataImpl.java:654)
[INFO] at org.hibernate.validator.metadata.BeanMetaDataImpl.initClass(BeanMetaDataImpl.java:546)
[INFO] at org.hibernate.validator.metadata.BeanMetaDataImpl.createMetaData(BeanMetaDataImpl.java:540)
[INFO] at org.hibernate.validator.metadata.BeanMetaDataImpl.<init>(BeanMetaDataImpl.java:209)
[INFO] at org.hibernate.validator.metadata.BeanMetaDataImpl.<init>(BeanMetaDataImpl.java:163)
[INFO] at org.hibernate.validator.engine.ValidatorImpl.getBeanMetaData(ValidatorImpl.java:1211)
[INFO] at org.hibernate.validator.engine.ValidatorImpl.getConstraintsForClass(ValidatorImpl.java:251)
[INFO] at com.google.gwt.validation.rebind.BeanHelperCache.doCreateHelper(BeanHelperCache.java:113)
If I add the add-opens parameter like this:
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<moduleName>xxxxxxxxxxxxx</moduleName>
<jvmArgs>
<jvmArg>-showversion</jvmArg>
<jvmArg>-Xmx2048M</jvmArg>
<jvmArg>--add-opens java.base/java.util=ALL-UNNAMED</jvmArg>
</jvmArgs>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
then, I get the following error:
[INFO] --- gwt-maven-plugin:1.0.1:compile (default-cli) # xxxxxx ---
[WARNING] Unrecognized option: --add-opens java.base/java.util=ALL-UNNAMED
[WARNING] Error: Could not create the Java Virtual Machine.
[WARNING] Error: A fatal exception has occurred. Program will exit.
Above the log stated, that I use a jdk-17.
How do I need to set the add-opens parameter ?
Do you see any other workaround?

The comment from Stuart solved my issue. Thanks a lot.
The following configuration worked for me:
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<moduleName>xxxxxxxx</moduleName>
<jvmArgs>
<jvmArg>-showversion</jvmArg>
<jvmArg>-Xmx2048M</jvmArg>
<jvmArg>--add-opens</jvmArg>
<jvmArg>java.base/java.util=ALL-UNNAMED</jvmArg>
</jvmArgs>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>

Related

Maven not building Scala project correctly

Problem
I got a Maven - Scala project. It compiles etc. when I want to build it in IntelliJ it works but the output jar is empty except a pom.xml.
When a build the whole project via command line with mvn scala:compile I get the following errors:
[INFO] Compiling 67 source files to /Users/my.name/Documents/company/util/util/target/classes at 1555483575272
[ERROR] error: scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
[ERROR] at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
[ERROR] at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:53)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:45)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:45)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getClassByName(Mirrors.scala:102)
[ERROR] at scala.reflect.internal.Mirrors$RootsBase.getRequiredClass(Mirrors.scala:105)
[ERROR] at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass$lzycompute(Definitions.scala:257)
[ERROR] at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:257)
[ERROR] at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1394)
[ERROR] at scala.tools.nsc.Global$Run.<init>(Global.scala:1215)
[ERROR] at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
[ERROR] at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
[ERROR] at scala.tools.nsc.Driver.process(Driver.scala:51)
[ERROR] at scala.tools.nsc.Driver.main(Driver.scala:64)
[ERROR] at scala.tools.nsc.Main.main(Main.scala)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR] at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
[ERROR] at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.256 s
[INFO] Finished at: 2019-04-17T08:46:16+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.3.1:compile (default-cli) on project util: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
I also can run mvn compile which succeeds but produces an empty jar:
[INFO] Building util 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # util ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/markus.geilehner/Documents/Syniverse/util/util/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) # util ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /Users/markus.geilehner/Documents/Syniverse/util/util/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.334 s
[INFO] Finished at: 2019-04-17T09:03:55+02:00
[INFO] ------------------------------------------------------------------------
Project File Structure
-util
--src
---main
----scala
-----com.company.util
------Scala Classes and packages
pom.xml
Here some parts of the pom.xml. I use the net.alchim Scala-maven plugin.
The build process is configured to use the scala directory.
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<reportPlugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<jvmArgs>
<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
</configuration>
</plugin>
</reportPlugins>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
Solution
I had the same error when working with a scala project combined with maven.
Issue-1
One Issue can be that you use the wrong Java-Version (9/10) try to change it to Java 8 (1.8) in IntelliJ (File => Project-Structure).
Issue-2
In your pom add the following execution beneath the maven-scala plugin.
<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>
Do a clean install an try again.

Custom unit test folder/path doesn't see custom src folder/path in Maven project when using terminal

I have a custom structure in my project of
Development -
- src
- test
and running tests works fine through eclipse but when I use the terminal on my mac to run the test (mvn test), the src classes are not found (fails during maven compile plugin). I figure it has to be an issue with my pom not guiding the plugins to the right folders. If I comment out this line,
<outputDirectory>Development/build</outputDirectory>
it works fine because the .class files r now being placed in the target folder. Instead of looking at the target folder for the.class files, I need maven to look at the
Development/build
directory if I'm not mistaken. Right?
I would like to continue to use my custom file structure and correct my pom so that it compiles and runs unit test through my mac's terminals.
<build>
<sourceDirectory>Development/src/main</sourceDirectory>
<testSourceDirectory>Development/src/test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<outputDirectory>Development/build</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<classesDirectory>Development/build</classesDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>auto-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>Development/build</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptors>
<descriptor>Development/src/assembly/assembly.xml</descriptor>
</descriptors>
<tarLongFileMode>posix</tarLongFileMode>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</configuration>
</plugin>
</plugins>
</build>
This is the console output
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) # weatherdetails ---
[INFO] Deleting /Users/username/git/weatherdetails/target
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (auto-clean) # weatherdetails ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # weatherdetails ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/username/git/weatherdetails/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # weatherdetails ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2503 source files to /Users/username/git/weatherdetails/Development/build
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # weatherdetails ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/username/git/weatherdetails/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) # weatherdetails ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/username/git/weatherdetails/Development/build
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/username/git/weatherdetails/Development/src/test/com/wfc/schedulers/WeeklySchedulerTest.java:[12,26] cannot find symbol
symbol: class WeeklyScheduler
location: package com.wfc.schedulers
Any suggestions on what's not configured correctly?
I was able to get this work shortly after making this post but wanted to see if someone had a different answer. While formatting this post to meet the stackoverflow standards, I noticed the compiler plugin was writing the classes to /Users/username/git/weatherdetails/Development/build. i said wait thats wrong. it should write them to /Users/username/git/weatherdetails/Development/build/classes and /Users/username/git/weatherdetails/Development/build/test-classes. i googled how to change the target directory in the pom and ran into this tag
<directory>Development/build</directory>
I added it to the build and removed the
<outputDirectory>Development/build</outputDirectory>
tag from the compiler plugin because i added it there thinking that it was creating the custom target folder in the path. Ran it and it worked. So now my build looks like this
<build>
<sourceDirectory>Development/src/main</sourceDirectory>
<testSourceDirectory>Development/src/test</testSourceDirectory>
<!-- if you put just Development, it will erase everything in the development folder -->
<directory>Development/build</directory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<classesDirectory>Development/build</classesDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>auto-clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>Development/build</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptors> <descriptor>Development/src/assembly/assembly.xml</descriptor>
</descriptors>
<tarLongFileMode>posix</tarLongFileMode>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</configuration>
</plugin>
</plugins>
</build>
Hope this helps someone!

Attach source directory with build-helper-maven

I tried to attach a source directory generated by jaxb or cxf in using the build-helper-maven plugin. Unfortunately, even though I got a success in the mvn generate-sources, my eclipse didn't add the target directory as a source folder.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated/cxf</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Log :
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # coucou-services ---
[INFO] Deleting D:\004_Development\coucou\Workspace\coucou-bom\coucou-services\target
[INFO]
[INFO] --- cxf-codegen-plugin:2.4.6:wsdl2java (generate-sources) # coucou-services ---
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-source (add-source) # coucou-services ---
[INFO] Source directory: D:\004_Development\coucou\Workspace\coucou-bom\coucou-services\target\generated\cxf added.
[INFO]
[INFO] -
Do you have any idea ?
Best regards
Eclipse's M2 plugin will interpret better the declarations within the build section. Try this:
<build>
<sourceDirectory>${project.build.directory}/generated/cxf</sourceDirectory>
</build>

Errors when using maven plugin for Weblogic deployment

I have been trying to deploy application to Weblogic 10.3.6 using maven
I have created weblogic plugin for maven as mentioned in this article.
I have added the following to pom.xml
<build>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.3</version>
<configuration>
<goalPrefix>weblogic</goalPrefix>
</configuration>
</plugin>
<plugin>
<groupId>weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>10.3.6.0</version>
<configuration>
<adminurl>t3://localdomain:7001</adminurl>
<user>weblogic</user>
<password>password</password>
<name>wldemo</name>
<remote>true</remote>
<upload>true</upload>
<targets>AdminServer</targets>
</configuration>
<executions>
<execution>
<id>deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<source>target/EmployeesApp-1.0-SNAPSHOT.war</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
When I did mvn com.oracle.weblogic:weblogic-maven-plugin:deploy I am getting the following errors, how can I resolve these errors?
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.oracle.weblogic:weblogic-maven-plugin:10.3.6.
0:deploy (default-cli) on project EmployeesApp: The parameters 'source' for goal
com.oracle.weblogic:weblogic-maven-plugin:10.3.6.0:deploy are missing or invali
d
You have specified the source parameter in the execution configuration, so in order to make it taken into account you should invoke this particular execution. It can be done using the phase key you specified, so e.g.:
mvn integration-test
Maven will go through the whole lifecycle and on the pre-integration-test test phase (which precedes the integration-test one) it will run the execution of weblogic-maven-plugin you configured.

Maven is not finding scala tests

I have a scala test class but when I attempt to run using the Maven goal 'test'
the tests are not being run. I receive the Maven message "There are no tests to run." even though the tests are located in the scala test class. Do I need to add extra configuration ?
Here is my package setup :
Here is the output of the Maven "test" goal when run against the pom file :
[INFO] Scanning for projects... [INFO]
[INFO]
------------------------------------------------------------------------ [INFO] Building scala.maven.test 0.0.1-SNAPSHOT [INFO]
------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.4.3:resources
(default-resources) # scala.maven.test --- [WARNING] Using platform
encoding (Cp1252 actually) to copy filtered resources, i.e. build is
platform dependent! [INFO] Copying 0 resource [INFO] [INFO] ---
maven-scala-plugin:2.9.1:add-source (scala-compile-first) #
scala.maven.test --- [INFO] Add Source directory:
C:\workspaces\29112012\scala.maven.test\src\main\scala [INFO] Add Test
Source directory:
C:\workspaces\29112012\scala.maven.test\src\test\scala [INFO] [INFO]
--- maven-scala-plugin:2.9.1:compile (scala-compile-first) # scala.maven.test --- [ERROR]
C:\workspaces\29112012\scala.maven.test\src\main\java [ERROR]
C:\workspaces\29112012\scala.maven.test\src\main\scala [ERROR]
C:\workspaces\29112012\scala.maven.test\src\test\scala [INFO]
Compiling 2 source files to
C:\workspaces\29112012\scala.maven.test\target\classes [INFO] [INFO]
--- maven-compiler-plugin:2.0.2:compile (default-compile) # scala.maven.test --- [INFO] Nothing to compile - all classes are up to
date [INFO] [INFO] --- maven-compiler-plugin:2.0.2:compile (default)
# scala.maven.test --- [INFO] Nothing to compile - all classes are up
to date [INFO] [INFO] --- maven-resources-plugin:2.4.3:testResources
(default-testResources) # scala.maven.test --- [WARNING] Using
platform encoding (Cp1252 actually) to copy filtered resources, i.e.
build is platform dependent! [INFO] Copying 0 resource [INFO] [INFO]
--- maven-scala-plugin:2.9.1:testCompile (scala-test-compile) # scala.maven.test --- [ERROR]
C:\workspaces\29112012\scala.maven.test\src\test\java [ERROR]
C:\workspaces\29112012\scala.maven.test\src\test\java..\scala [INFO]
Compiling 1 source files to
C:\workspaces\29112012\scala.maven.test\target\test-classes [INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile
(default-testCompile) # scala.maven.test --- [INFO] Nothing to compile
- all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.7.1:test (default-test) # scala.maven.test ---
[INFO] Surefire report directory:
C:\workspaces\29112012\scala.maven.test\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: 11.354s [INFO] Finished at: Fri Nov 30 16:57:05 GMT
2012 [INFO] Final Memory: 7M/17M [INFO]
Here is my pom.xml :
<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>scala.maven.test</groupId>
<artifactId>scala.maven.test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.9.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.scala-tools
</groupId>
<artifactId>
maven-scala-plugin
</artifactId>
<versionRange>
[2.9.1,)
</versionRange>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-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>
<dependencies>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.0-1</artifactId>
<version>2.0.M5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
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.
What's your test class name? Maven can be pretty picky and by default I think it requires the class name to end in 'Test'.
See my previos post:
Maven won't run tests