Maven compilation failes (but compilation under Eclipse is successful) - java

While building my web project from Eclipse, everything is fine: no errors, no warnings.
However while building project with Maven it failes. Below is the output form mvn compile:
c:\Users\jwa\Desktop\tets\traffic_web>mvn
compile -e
+ Error stacktraces are turned on. [INFO] Scanning for projects... [INFO]
------------------------------------------------------------------------ [INFO] Building traffic_web [INFO]
task-segment: [compile] [INFO]
------------------------------------------------------------------------ [INFO] [resources:resources
{execution: default-resources}]
[WARNING] Using platform encoding
(Cp1250 actually) to copy filtered
resources, i.e. build is platform
dependent! [INFO] skip non existing
resourceDirectory
c:\Users\jwa\Desktop\tets\traffic_web\src\main\resources
[INFO] [compiler:compile {execution:
default-compile}] [INFO] Compiling 22
source files to
c:\Users\jwa\Desktop\tets\traffic_web\target\classes
[INFO]
------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Compilation failure
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\Encryptor.java:[7,15]
sun.misc.BASE64Encoder is Sun propriet
ary API and may be removed in a future
release
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\Session.java:[3,25]
package javax.servlet.http does not
exis t
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\Session.java:[15,21]
cannot find symbol symbol : class
HttpSession location: class
traffic_web.tools.Session
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\ServletContextListenerInitializer.java:[6,20]
package javax. servlet does not exist
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\ServletContextListenerInitializer.java:[7,20]
package javax. servlet does not exist
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\ServletContextListenerInitializer.java:[8,20]
package javax. servlet does not exist
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\ServletContextListenerInitializer.java:[10,58]
cannot find s ymbol symbol: class
ServletContextListener public class
ServletContextListenerInitializer
implements ServletContextListener {
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\ServletContextListenerInitializer.java:[12,33]
cannot find s ymbol symbol : class
ServletContextEvent location: class
traffic_web.tools.ServletContextListenerInitializer
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\ServletContextListenerInitializer.java:[15,35]
cannot find s ymbol symbol : class
ServletContextEvent location: class
traffic_web.tools.ServletContextListenerInitializer
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\controller\BoardController.java:[9,25]
package javax.servlet.http does not
exist
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\controller\BoardController.java:[87,29]
cannot find symbol symbol : class
HttpServletResponse location: class
traffic_web.controller.BoardController
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\controller\BoardController.java:[116,37]
cannot find symbol symbol : class
HttpServletResponse location: class
traffic_web.controller.BoardController
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\Encryptor.java:[27,15]
sun.misc.BASE64Encoder is Sun proprie
tary API and may be removed in a
future release
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\Session.java:[17,27]
cannot access
javax.servlet.http.HttpSe rvletRequest
class file for
javax.servlet.http.HttpServletRequest
not found
return attr.getRequest().getSession(true); //
true == allow create
c:\Users\jwa\Desktop\tets\traffic_web\src\traffic_web\tools\ServletContextListenerInitializer.java:[17,8]
cannot find sy mbol symbol : class
ServletContext location: class
traffic_web.tools.ServletContextListenerInitializer
[INFO]
------------------------------------------------------------------------ [INFO] Trace
org.apache.maven.BuildFailureException:
Compilation failure
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:55
6)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.jav
a:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by:
org.apache.maven.plugin.CompilationFailureException:
Compilation failure
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO]
Finished at: Mon Jun 28 21:56:25 CEST
2010 [INFO] Final Memory: 13M/254M
[INFO]
My POM file looks like that:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>masters.traffic</groupId>
<artifactId>traffic_web</artifactId>
<packaging>war</packaging>
<name>traffic_web</name>
<version>0.1.0</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
Can Someone help me how to fix that ?
Regards

You haven't added the servlet classes as dependencies. There are apparently present per default in Eclipse, which is why it works to compile from there. Add the following to you pom (before <build>..., taken from here):
<dependencies>
[...]
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>

Related

Maven Compile GWT & OpenJDK 11

Recently, I am trying to switch my project to use OpenJDK 11, however the Maven build is failing because one of the GWT modules is failing to compile.
The project currently uses GWT 2.6.0, and I've tried updating to 2.8.2 if any of the newer versions is compatible with OpenJDK 11. The build is run from Eclipse IDE 4.9.0
When running with 2.6.0, the following error occurs:
Compiling module XXXXModule
[INFO] Looking for precompiled archives. To disable, use -Dgwt.usearchives=false
[INFO] Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/user/User.gwtar
[INFO] Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/core/Core.gwtar
[INFO] Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/regexp/RegExp.gwtar
[INFO] Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/web/bindery/event/Event.gwtar
[INFO] Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/xml/XML.gwtar
[INFO] Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/json/JSON.gwtar
[INFO] Found 0 cached/archived units. Used 0 / 0 units from cache.
[INFO] Compiling...
[INFO] Compilation completed in 0.00 seconds
[INFO] Added 0 units to cache since last cleanup.
[INFO] Validating units:
[INFO] Removing invalidated units
[INFO] Checked 0 dependencies for errors.
[INFO] [ERROR] Unable to find type 'java.lang.Object'
[INFO] [ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
[INFO] Shutting down PersistentUnitCache thread
....
[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.6.0:compile (default) on project tlm-war: Command [[
[ERROR] C:\jdk-11.0.1\bin\java -Xmx512M -Xss1024k -classpath .... -localWorkers 4 -XfragmentCount -1 -sourceLevel auto -gen C:\Users\XXXX\gitrepos\XXXX\XXXX\XXXX\target\.generated XXXXModule XXXXModule XXXXModule XXXXModule
But investigating XXXXModule.gwt.xml, the file does include 'Core'
<module>
<inherits name="com.google.gwt.user.User" />
<inherits name="com.smartgwt.SmartGwt" />
....
I did some investigation online, and according to this answer, Migrating a GWT 2.5 web app to Java 10, I should try upgrading to GWT 2.8.2, but the build gets another issue:
[ERROR] Unexpected internal compiler error
[INFO] java.lang.SecurityException: class "org.eclipse.jdt.internal.compiler.ast.LambdaExpression"'s signer information does not match signer information of other classes in the same package
[INFO] at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1150)
[INFO] at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:905)
[INFO] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
[INFO] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
[INFO] at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
[INFO] at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
[INFO] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
[INFO] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
[INFO] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
[INFO] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
[INFO] at com.google.gwt.dev.jjs.impl.GwtAstBuilder.<init>(GwtAstBuilder.java:3881)
[INFO] at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:3970)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:129)
[INFO] at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:336)
[INFO] at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:470)
[INFO] at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1040)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:325)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:548)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:479)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:465)
[INFO] at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:423)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:222)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:202)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:143)
[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:204)
[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:155)
[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:144)
[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:118)
[INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
[INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:125)
Has anyone else been successful in compiling GWT 2.6-2.8.2 with OpenJDK 11?
EDIT:
Snippet of pom.xml
....
<properties>
<gwt.version>2.8.2</gwt.version>
<smartgwt.version>2.4</smartgwt.version>
</properties>
....
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<configuration>
<modules>
<module>XXXXModule</module>
<module>XXXXModule</module>
<module>XXXXModule</module>
<module>XXXXModule</module>
</modules>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<logLevel>DEBUG</logLevel>
</configuration>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
Classpath:
C:\Users\XXXX\.m2\repository\com\google\gwt\gwt-servlet\2.8.2\gwt-servlet-2.8.2.jar
C:\Users\XXXX\.m2\repository\com\google\gwt\gwt-user\2.8.2\gwt-user-2.8.2.jar
C:\Users\XXXX\.m2\repository\com\google\jsinterop\jsinterop-annotations\1.0.2\jsinterop-annotations-1.0.2.jar
C:\Users\XXXX\.m2\repository\com\google\jsinterop\jsinterop-annotations\1.0.2\jsinterop-annotations-1.0.2-sources.jar
C:\Users\XXXX\.m2\repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA.jar
C:\Users\XXXX\.m2\repository\javax\validation\validation-api\1.0.0.GA\validation-api-1.0.0.GA-sources.jar
C:\Users\XXXX\.m2\repository\javax\servlet\javax.servlet-api\3.0.1\javax.servlet-api-3.0.1.jar
C:\Users\XXXX\.m2\repository\org\w3c\css\sac\1.3\sac-1.3.jar
C:\Users\XXXX\.m2\repository\com\smartgwt\smartgwt\2.4\smartgwt-2.4.jar
C:\Users\XXXX\.m2\repository\com\smartgwt\smartgwt-skins\2.4\smartgwt-skins-2.4.jar
C:\Users\XXXX\.m2\repository\org\slf4j\slf4j-api\1.7.6\slf4j-api-1.7.6.jar
C:\Users\XXXX\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.6\jcl-over-slf4j-1.7.6.jar
C:\Users\XXXX\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.6\log4j-over-slf4j-1.7.6.jar
C:\Users\XXXX\.m2\repository\ch\qos\logback\logback-classic\1.1.1\logback-classic-1.1.1.jar
C:\Users\XXXX\.m2\repository\ch\qos\logback\logback-core\1.1.1\logback-core-1.1.1.jar
C:\Users\XXXX\.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar
C:\Users\XXXX\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar
C:\Users\XXXX\.m2\repository\org\jasypt\jasypt\1.9.2\jasypt-1.9.2.jar
C:\Users\XXXX\.m2\repository\org\hibernate\hibernate-core\4.3.5.Final\hibernate-core-4.3.5.Final.jar
C:\Users\XXXX\.m2\repository\org\jboss\logging\jboss-logging\3.1.3.GA\jboss-logging-3.1.3.GA.jar
C:\Users\XXXX\.m2\repository\org\jboss\logging\jboss-logging-annotations\1.2.0.Beta1\jboss-logging-annotations-1.2.0.Beta1.jar
C:\Users\XXXX\.m2\repository\org\jboss\spec\javax\transaction\jboss-transaction-api_1.2_spec\1.0.0.Final\jboss-transaction-api_1.2_spec-1.0.0.Final.jar
C:\Users\XXXX\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar
C:\Users\XXXX\.m2\repository\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar
C:\Users\XXXX\.m2\repository\org\hibernate\common\hibernate-commons-annotations\4.0.4.Final\hibernate-commons-annotations-4.0.4.Final.jar
C:\Users\XXXX\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar
C:\Users\XXXX\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar
C:\Users\XXXX\.m2\repository\org\jboss\jandex\1.1.0.Final\jandex-1.1.0.Final.jar
C:\Users\XXXX\.m2\repository\org\hibernate\hibernate-jpamodelgen\4.3.5.Final\hibernate-jpamodelgen-4.3.5.Final.jar
C:\Users\XXXX\.m2\repository\org\hibernate\hibernate-tools\4.3.1.CR1\hibernate-tools-4.3.1.CR1.jar
C:\Users\XXXX\.m2\repository\org\hibernate\hibernate-entitymanager\4.3.1.Final\hibernate-entitymanager-4.3.1.Final.jar
C:\Users\XXXX\.m2\repository\javax\transaction\jta\1.1\jta-1.1.jar
C:\Users\XXXX\.m2\repository\freemarker\freemarker\2.3.8\freemarker-2.3.8.jar
C:\Users\XXXX\.m2\repository\org\hibernate\jtidy\r8-20060801\jtidy-r8-20060801.jar
C:\Users\XXXX\.m2\repository\org\eclipse\tycho\org.eclipse.jdt.core\3.9.1.v20130905-0837\org.eclipse.jdt.core-3.9.1.v20130905-0837.jar
C:\Users\XXXX\.m2\repository\org\eclipse\text\3.3.0-v20070606-0010\text-3.3.0-v20070606-0010.jar
C:\Users\XXXX\.m2\repository\org\eclipse\core\commands\3.3.0-I20070605-0010\commands-3.3.0-I20070605-0010.jar
C:\Users\XXXX\.m2\repository\org\eclipse\equinox\common\3.6.200-v20130402-1505\common-3.6.200-v20130402-1505.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-context\3.2.9.RELEASE\spring-context-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-aop\3.2.9.RELEASE\spring-aop-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-beans\3.2.9.RELEASE\spring-beans-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-expression\3.2.9.RELEASE\spring-expression-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-jdbc\3.2.9.RELEASE\spring-jdbc-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-tx\3.2.9.RELEASE\spring-tx-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-core\3.2.9.RELEASE\spring-core-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-orm\3.2.9.RELEASE\spring-orm-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\com\oracle\jdbc\ojdbc6\11.2.0.3.0\ojdbc6-11.2.0.3.0.jar
C:\Users\XXXX\.m2\repository\com\oracle\ucp\ucp\11.2.0.3.0\ucp-11.2.0.3.0.jar
C:\Users\XXXX\.m2\repository\com\mysema\querydsl\querydsl-sql\2.8.2\querydsl-sql-2.8.2.jar
C:\Users\XXXX\.m2\repository\com\mysema\querydsl\querydsl-core\2.8.2\querydsl-core-2.8.2.jar
C:\Users\XXXX\.m2\repository\com\google\guava\guava\11.0.2\guava-11.0.2.jar
C:\Users\XXXX\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar
C:\Users\XXXX\.m2\repository\com\mysema\commons\mysema-commons-lang\0.2.4\mysema-commons-lang-0.2.4.jar
C:\Users\XXXX\.m2\repository\cglib\cglib\2.2\cglib-2.2.jar
C:\Users\XXXX\.m2\repository\asm\asm\3.1\asm-3.1.jar
C:\Users\XXXX\.m2\repository\joda-time\joda-time\1.6\joda-time-1.6.jar
C:\Users\XXXX\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar
C:\Users\XXXX\.m2\repository\org\springframework\data\spring-data-jdbc-core\1.0.0.RELEASE\spring-data-jdbc-core-1.0.0.RELEASE.jar
C:\Users\XXXX\.m2\repository\org\springframework\retry\spring-retry\1.0.0.RELEASE\spring-retry-1.0.0.RELEASE.jar
C:\Users\XXXX\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar
C:\Users\XXXX\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar
C:\Users\XXXX\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar
C:\Users\XXXX\.m2\repository\commons-beanutils\commons-beanutils\1.9.1\commons-beanutils-1.9.1.jar
C:\Users\XXXX\.m2\repository\commons-configuration\commons-configuration\1.10\commons-configuration-1.10.jar
C:\Users\XXXX\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar
C:\Users\XXXX\.m2\repository\org\springframework\spring-test\3.2.9.RELEASE\spring-test-3.2.9.RELEASE.jar
C:\Users\XXXX\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar
C:\Users\XXXX\.m2\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar
C:\Users\XXXX\.m2\repository\org\glassfish\jaxb\jaxb-runtime\2.3.1\jaxb-runtime-2.3.1.jar
C:\Users\XXXX\.m2\repository\org\glassfish\jaxb\txw2\2.3.1\txw2-2.3.1.jar
C:\Users\XXXX\.m2\repository\com\sun\istack\istack-commons-runtime\3.0.7\istack-commons-runtime-3.0.7.jar
C:\Users\XXXX\.m2\repository\org\jvnet\staxex\stax-ex\1.8\stax-ex-1.8.jar
C:\Users\XXXX\.m2\repository\com\sun\xml\fastinfoset\FastInfoset\1.2.15\FastInfoset-1.2.15.jar
C:\Users\XXXX\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar
C:\Users\XXXX\.m2\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar
C:\Users\XXXX\.m2\repository\org\apache\cxf\cxf-xjc-plugin\3.2.3\cxf-xjc-plugin-3.2.3.jar
C:\Users\XXXX\.m2\repository\org\sonatype\plexus\plexus-build-api\0.0.7\plexus-build-api-0.0.7.jar
C:\Users\XXXX\.m2\repository\org\codehaus\plexus\plexus-utils\2.0.5\plexus-utils-2.0.5.jar
C:\Users\XXXX\.m2\repository\org\codehaus\plexus\plexus-archiver\1.2\plexus-archiver-1.2.jar
C:\Users\XXXX\.m2\repository\org\codehaus\plexus\plexus-container-default\1.0-alpha-9-stable-1\plexus-container-default-1.0-alpha-9-stable-1.jar
C:\Users\XXXX\.m2\repository\classworlds\classworlds\1.1-alpha-2\classworlds-1.1-alpha-2.jar
C:\Users\XXXX\.m2\repository\org\codehaus\plexus\plexus-io\1.0.1\plexus-io-1.0.1.jar
C:\Users\XXXX\.m2\repository\org\apache\maven\shared\maven-artifact-resolver\1.0\maven-artifact-resolver-1.0.jar
C:\Users\XXXX\.m2\repository\com\sun\xml\bind\jaxb-xjc\2.3.0\jaxb-xjc-2.3.0.jar
C:\Users\XXXX\.m2\repository\com\sun\xml\bind\jaxb-impl\2.3.0\jaxb-impl-2.3.0.jar
C:\Users\XXXX\.m2\repository\com\sun\xml\bind\jaxb-core\2.3.0\jaxb-core-2.3.0.jar
C:\Users\XXXX\.m2\repository\xml-resolver\xml-resolver\1.2\xml-resolver-1.2.jar
C:\Users\XXXX\.m2\repository\org\javassist\javassist\3.18.2-GA\javassist-3.18.2-GA.jar
C:\Users\XXXX\.m2\repository\javax\xml\ws\jaxws-api\2.3.0\jaxws-api-2.3.0.jar
C:\Users\XXXX\.m2\repository\javax\xml\soap\javax.xml.soap-api\1.4.0\javax.xml.soap-api-1.4.0.jar
C:\Users\XXXX\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\7.0.91\tomcat-embed-core-7.0.91.jar
C:\Users\XXXX\.m2\repository\org\apache\tomcat\tomcat-annotations-api\7.0.91\tomcat-annotations-api-7.0.91.jar
C:\Users\XXXX\.m2\repository\org\apache\tomcat\embed\tomcat-embed-jasper\7.0.91\tomcat-embed-jasper-7.0.91.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jdt\core\compiler\ecj\4.4.2\ecj-4.4.2.jar
C:\Users\XXXX\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\7.0.91\tomcat-embed-el-7.0.91.jar
C:\Users\XXXX\.m2\repository\org\apache\tomcat\embed\tomcat-embed-logging-log4j\7.0.91\tomcat-embed-logging-log4j-7.0.91.jar
C:\Users\XXXX\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\7.0.91\tomcat-embed-websocket-7.0.91.jar
C:\Users\XXXX\.m2\repository\commons-fileupload\commons-fileupload\1.2\commons-fileupload-1.2.jar
C:\Users\XXXX\.m2\repository\javax\activation\activation\1.1.1\activation-1.1.1.jar
C:\Users\XXXX\.m2\repository\com\google\gwt\gwt-dev\2.8.2\gwt-dev-2.8.2.jar
C:\Users\XXXX\.m2\repository\com\google\code\findbugs\jsr305\1.3.9\jsr305-1.3.9.jar
C:\Users\XXXX\.m2\repository\com\google\code\gson\gson\2.6.2\gson-2.6.2.jar
C:\Users\XXXX\.m2\repository\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar
C:\Users\XXXX\.m2\repository\org\ow2\asm\asm-util\5.0.3\asm-util-5.0.3.jar
C:\Users\XXXX\.m2\repository\org\ow2\asm\asm-tree\5.0.3\asm-tree-5.0.3.jar
C:\Users\XXXX\.m2\repository\org\ow2\asm\asm-commons\5.0.3\asm-commons-5.0.3.jar
C:\Users\XXXX\.m2\repository\colt\colt\1.2.0\colt-1.2.0.jar
C:\Users\XXXX\.m2\repository\ant\ant\1.6.5\ant-1.6.5.jar
C:\Users\XXXX\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar
C:\Users\XXXX\.m2\repository\commons-io\commons-io\2.4\commons-io-2.4.jar
C:\Users\XXXX\.m2\repository\com\ibm\icu\icu4j\50.1.1\icu4j-50.1.1.jar
C:\Users\XXXX\.m2\repository\tapestry\tapestry\4.0.2\tapestry-4.0.2.jar
C:\Users\XXXX\.m2\repository\net\sourceforge\htmlunit\htmlunit\2.19\htmlunit-2.19.jar
C:\Users\XXXX\.m2\repository\xalan\xalan\2.7.2\xalan-2.7.2.jar
C:\Users\XXXX\.m2\repository\xalan\serializer\2.7.2\serializer-2.7.2.jar
C:\Users\XXXX\.m2\repository\xml-apis\xml-apis\1.4.01\xml-apis-1.4.01.jar
C:\Users\XXXX\.m2\repository\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar
C:\Users\XXXX\.m2\repository\org\apache\httpcomponents\httpclient\4.5.1\httpclient-4.5.1.jar
C:\Users\XXXX\.m2\repository\org\apache\httpcomponents\httpcore\4.4.3\httpcore-4.4.3.jar
C:\Users\XXXX\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar
C:\Users\XXXX\.m2\repository\commons-codec\commons-codec\1.10\commons-codec-1.10.jar
C:\Users\XXXX\.m2\repository\org\apache\httpcomponents\httpmime\4.5.1\httpmime-4.5.1.jar
C:\Users\XXXX\.m2\repository\net\sourceforge\htmlunit\htmlunit-core-js\2.17\htmlunit-core-js-2.17.jar
C:\Users\XXXX\.m2\repository\xerces\xercesImpl\2.11.0\xercesImpl-2.11.0.jar
C:\Users\XXXX\.m2\repository\net\sourceforge\nekohtml\nekohtml\1.9.22\nekohtml-1.9.22.jar
C:\Users\XXXX\.m2\repository\net\sourceforge\cssparser\cssparser\0.9.18\cssparser-0.9.18.jar
C:\Users\XXXX\.m2\repository\org\w3c\css\sac\1.3\sac-1.3.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\websocket\websocket-client\9.2.13.v20150730\websocket-client-9.2.13.v20150730.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-util\9.2.14.v20151106\jetty-util-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-io\9.2.14.v20151106\jetty-io-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\websocket\websocket-common\9.2.13.v20150730\websocket-common-9.2.13.v20150730.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\websocket\websocket-api\9.2.13.v20150730\websocket-api-9.2.13.v20150730.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-webapp\9.2.14.v20151106\jetty-webapp-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-xml\9.2.14.v20151106\jetty-xml-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-servlet\9.2.14.v20151106\jetty-servlet-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-security\9.2.14.v20151106\jetty-security-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-server\9.2.14.v20151106\jetty-server-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-http\9.2.14.v20151106\jetty-http-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-servlets\9.2.14.v20151106\jetty-servlets-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-continuation\9.2.14.v20151106\jetty-continuation-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-annotations\9.2.14.v20151106\jetty-annotations-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-plus\9.2.14.v20151106\jetty-plus-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\jetty-jndi\9.2.14.v20151106\jetty-jndi-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\javax\annotation\javax.annotation-api\1.2\javax.annotation-api-1.2.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\apache-jsp\9.2.14.v20151106\apache-jsp-9.2.14.v20151106.jar
C:\Users\XXXX\.m2\repository\org\eclipse\jetty\toolchain\jetty-schemas\3.1.M0\jetty-schemas-3.1.M0.jar
C:\Users\XXXX\.m2\repository\org\mortbay\jasper\apache-jsp\8.0.9.M3\apache-jsp-8.0.9.M3.jar
C:\Users\XXXX\.m2\repository\org\mortbay\jasper\apache-el\8.0.9.M3\apache-el-8.0.9.M3.jar
Now I did notice that gwt-dev and ecj jar does have LambdaExpression with the same package. But I removed ecj and I still get the same issue. Apache-jsp jar does have a LambdaExpression but different package so I doubt that is the issue.
GWT 2.8.2 works with openjdk11. Here you can see that the tbroyer gwt-maven-plugin works with openjdk8 and openjdk11 using both last GWT release (version 2.8.2) and last development commit (version HEAD-SNAPSHOT).
So, you really should upgrade to GWT 2.8.2. GWT only support the last version. Usually upgrading between version is trivial because almost no API changes have been made for years and only bug fixes and new java language support has been added. It should be quite easy.
In your case, it seems to be a dependency problem, maybe because some of your dependencies have a dependency on the old version of GWT itself. To avoid dependencies conflicts it is recommended to use the BOM dependency. This tutorial includes a minimal explanation of why and how to use the GWT BOM dependency. Essentially, add this in your root project pom.xml:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>2.8.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

JBehave throwing NullPointerException when running embeddable stories

I am working on a Spring MVC rest service, for which I am also trying to set up JBehave. This is a Maven project with a single module, and the JBehave code is living under the test scope of that module. My problem is that my sample test (which is just an empty test) is failing with an NPE. I was expecting to see the test pass so that I know JBehave is set up properly. Can you take a look at what I've got and see if you can help me spot what is causing the NPE?
First, relevant parts of my maven configuration:
<properties>
<jbehave.version>4.0.4</jbehave.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>${jbehave.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-spring</artifactId>
<version>${jbehave.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jbehave.site</groupId>
<artifactId>jbehave-site-resources</artifactId>
<version>3.1.1</version>
<scope>test</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>${jbehave.version}</version>
<classifier>resources</classifier>
<type>zip</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<scope>test</scope>
<testSourceDirectory>${basedir}/src/test/java/</testSourceDirectory>
<testClassesDirectory>${project.build.directory}/test-classes/</testClassesDirectory>
<includes>
<include>com/mycompany/myproject/test/behavior/steps/*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.version}</version>
<configuration>
<scope>test</scope>
</configuration>
<executions>
<execution>
<id>unpack-view-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack-view-resources</goal>
</goals>
</execution>
<execution>
<id>run-stories-as-embeddables</id>
<phase>integration-test</phase>
<configuration>
<scope>test</scope>
<includes>
<include>com/mycompany/myproject/test/behavior/steps/*.java</include>
</includes>
<systemProperties>
<property>
<name>java.awt.headless</name>
<value>true</value>
</property>
</systemProperties>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
</build>
I run my tests via mvn clean integration-test -e and I get this output:
$ mvn clean integration-test -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject 0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # MyProject ---
[INFO] Deleting C:\Users\mylogin\myproject\target
[INFO]
[INFO] --- jbehave-maven-plugin:4.0.4:unpack-view-resources (unpack-view-resources) # MyProject ---
[INFO] Unpacked C:\Users\mylogin\.m2\repository\org\jbehave\site\jbehave-site-resources\3.1.1\jbehave-site-resources-3.1.1.zip to C:\Users\mylogin\myproject\target\jbehave\view
[INFO] Unpacked C:\Users\mylogin\.m2\repository\org\jbehave\jbehave-core\4.0.4\jbehave-core-4.0.4-resources.zip to C:\Users\mylogin\myproject\target\jbehave\view
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # MyProject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 18 resources
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # MyProject ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 62 source files to C:\Users\mylogin\myproject\target\classes
... omitted ...
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # MyProject ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # MyProject ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 12 source files to C:\Users\mylogin\myproject\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # MyProject ---
[INFO] Surefire report directory: C:\Users\mylogin\myproject\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.mycompany.myproject.test.behavior.steps.SampleRestCallWithInvalidAccountSteps
Processing system properties {}
Using controls EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=true,ignoreFailureInView=false,verboseFailures=true,verboseFiltering=false,storyTimeouts=300,threads=1,failOnStoryTimeout=false]
Running story com/mycompany/myproject/test/behavior/steps/sample_rest_call_with_invalid_account_steps.story
Generating reports view to 'C:\Users\mylogin\myproject\target\jbehave' using formats '[stats, ide_console, txt, html]' and view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
Reports view generated with 2 stories (of which 1 pending) containing 1 scenarios (of which 1 pending)
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.326 sec - in com.mycompany.myproject.test.behavior.steps.SampleRestCallWithInvalidAccountSteps
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:3.0.0:war (default-war) # MyProject ---
[INFO] Packaging webapp
[INFO] Assembling webapp [MyProject] in [C:\Users\mylogin\myproject\target\mywarname##0.1]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\mylogin\myproject\src\main\webapp]
[INFO] Webapp assembled in [484 msecs]
[INFO] Building war: C:\Users\mylogin\myproject\target\mywarname##0.1.war
[INFO]
[INFO] --- spring-boot-maven-plugin:1.3.5.RELEASE:repackage (default) # MyProject ---
[INFO]
[INFO] --- jbehave-maven-plugin:4.0.4:run-stories-as-embeddables (run-stories-as-embeddables) # MyProject ---
[INFO] Running stories as embeddables using embedder Embedder[storyMapper=StoryMapper,embedderMonitor=MavenEmbedderMonitor,classLoader=EmbedderClassLoader[urls=[/C:/Users/mylogin/Projects/AQ/aqservices/target/test-classes/, /C:/Users/mylogin/Projects/AQ/aqservices/target/classes/, spring-boot-starter-tomcat-1.3.5.RELEASE.jar, tomcat-embed-core-8.0.33.jar, tomcat-embed-el-8.0.33.jar, tomcat-embed-logging-juli-8.0.33.jar, tomcat-embed-websocket-8.0.33.jar, spring-ws-core-2.3.0.RELEASE.jar, spring-xml-2.3.0.RELEASE.jar, spring-aop-4.2.6.RELEASE.jar, spring-beans-4.2.6.RELEASE.jar, spring-core-4.2.6.RELEASE.jar, spring-oxm-4.2.6.RELEASE.jar, spring-web-4.2.6.RELEASE.jar, spring-webmvc-4.2.6.RELEASE.jar, spring-boot-starter-1.3.5.RELEASE.jar, spring-boot-1.3.5.RELEASE.jar, spring-boot-autoconfigure-1.3.5.RELEASE.jar, snakeyaml-1.16.jar, spring-boot-starter-log4j-1.3.7.RELEASE.jar, jcl-over-slf4j-1.7.21.jar, jul-to-slf4j-1.7.21.jar, slf4j-log4j12-1.7.21.jar, log4j-1.2.17.jar, spring-orm-4.3.2.RELEASE.jar, spring-jdbc-4.2.6.RELEASE.jar, spring-tx-4.2.6.RELEASE.jar, spring-data-commons-1.12.2.RELEASE.jar, spring-context-4.2.6.RELEASE.jar, spring-expression-4.2.6.RELEASE.jar, spring-context-support-4.1.4.RELEASE.jar, spring-test-4.2.6.RELEASE.jar, spring-security-core-4.1.1.RELEASE.jar, aopalliance-1.0.jar, spring-security-web-4.1.1.RELEASE.jar, spring-security-config-4.1.1.RELEASE.jar, jstl-1.2.jar, wsdl4j-1.6.3.jar, aspectjweaver-1.8.9.jar, jasypt-1.9.2.jar, xstream-1.4.9.jar, xmlpull-1.1.3.1.jar, xpp3_min-1.1.4c.jar, bcprov-jdk16-1.46.jar, org.apache.commons.io-2.4.jar, commons-io-2.4.jar, slf4j-api-1.7.21.jar, commons-lang-2.6.jar, mail-1.4.jar, activation-1.1.jar, dozer-5.5.1.jar, commons-beanutils-1.9.2.jar, commons-lang3-3.2.1.jar, jregex-1.2_01.jar, tomcat-embed-jasper-8.0.33.jar, ecj-4.5.jar, ehcache-2.10.2.2.21.jar, HikariCP-2.4.7.jar, emdq-1.0.jar, sqljdbc4-4.0.jar, ghs-verifyaq-client-1.0.3.jar, mockito-all-1.9.5.jar, junit-4.11.jar, hamcrest-core-1.3.jar, jbehave-core-4.0.4.jar, hamcrest-library-1.3.jar, hamcrest-integration-1.3.jar, commons-collections-3.2.2.jar, plexus-utils-3.0.10.jar, freemarker-2.3.23.jar, paranamer-2.4.jar, jbehave-spring-4.0.4.jar],parent=ClassRealm[plugin>org.jbehave:jbehave-maven-plugin:4.0.4, parent: sun.misc.Launcher$AppClassLoader#55f96302]],embedderControls=UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=false,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeouts=300,threads=1,failOnStoryTimeout=false]],embedderFailureStrategy=<null>,configuration=org.jbehave.core.configuration.MostUsefulConfiguration#645b2ac7,candidateSteps=<null>,stepsFactory=<null>,metaFilters=<null>,metaMatchers=<null>,systemProperties={java.awt.headless=true},executorService=<null>,executorServiceCreated=false,performableTree=PerformableTree,storyManager=<null>,timeoutParsers=<null>]
[INFO] Found class names: [com.mycompany.myproject.test.behavior.steps.SampleRestCallWithInvalidAccountSteps]
[INFO] Using controls UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=false,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeouts=300,threads=1,failOnStoryTimeout=false]]
[INFO] Running embeddable com.mycompany.myproject.test.behavior.steps.SampleRestCallWithInvalidAccountSteps
[INFO] Processing system properties {java.awt.headless=true}
[INFO] System property 'java.awt.headless' set to 'true'
[INFO] Using controls UnmodifiableEmbedderControls[EmbedderControls[batch=false,skip=false,generateViewAfterStories=true,ignoreFailureInStories=false,ignoreFailureInView=false,verboseFailures=false,verboseFiltering=false,storyTimeouts=300,threads=1,failOnStoryTimeout=false]]
[INFO] Generating reports view to 'C:\Users\mylogin\myproject\target\jbehave' using formats '[stats, ide_console, txt, html]' and view properties '{navigator=ftl/jbehave-navigator.ftl, views=ftl/jbehave-views.ftl, reports=ftl/jbehave-reports.ftl, nonDecorated=ftl/jbehave-report-non-decorated.ftl, decorated=ftl/jbehave-report-decorated.ftl, maps=ftl/jbehave-maps.ftl}'
[INFO] Reports view generated with 2 stories (of which 1 pending) containing 1 scenarios (of which 1 pending)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.714 s
[INFO] Finished at: 2017-03-28T13:25:28-04:00
[INFO] Final Memory: 38M/299M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jbehave:jbehave-maven-plugin:4.0.4:run-stories-as-embeddables (run-stories-as-embeddables) on project MyProject: Failed to run stories as embeddables: Failure in running embeddable: com.mycompany.myproject.test.behavior.steps.SampleRestCallWithInvalidAccountSteps: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jbehave:jbehave-maven-plugin:4.0.4:run-stories-as-embeddables (run-stories-as-embeddables) on project MyProject: Failed to run stories as embeddables
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run stories as embeddables
at org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:20)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: org.jbehave.core.embedder.Embedder$RunningEmbeddablesFailed: Failure in running embeddable: com.mycompany.myproject.test.behavior.steps.SampleRestCallWithInvalidAccountSteps
at org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:140)
at org.jbehave.mojo.RunStoriesAsEmbeddables.execute(RunStoriesAsEmbeddables.java:18)
... 22 more
Caused by: java.lang.NullPointerException
at org.jbehave.core.steps.spring.SpringStepsFactory.stepsTypes(SpringStepsFactory.java:39)
at org.jbehave.core.steps.AbstractStepsFactory.createCandidateSteps(AbstractStepsFactory.java:34)
at org.jbehave.core.embedder.PerformableTree$RunContext.<init>(PerformableTree.java:458)
at org.jbehave.core.embedder.PerformableTree.newRunContext(PerformableTree.java:1105)
at org.jbehave.core.embedder.StoryManager.runStories(StoryManager.java:100)
at org.jbehave.core.embedder.StoryManager.runStoriesAsPaths(StoryManager.java:86)
at org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:213)
at org.jbehave.core.junit.JUnitStory.run(JUnitStory.java:24)
at org.jbehave.core.embedder.Embedder.runAsEmbeddables(Embedder.java:131)
... 23 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/MojoFailureException
My story file, named sample_rest_call_with_invalid_account_steps.story:
Scenario: Call the sample rest resource
Given an initial value
When this API is called
Then expect failure
My java story class, named SampleRestCallWithInvalidAccountSteps.java:
import com.mycompany.myproject.test.behavior.driver.AbstractSpringJBehaveStory;
import com.mycompany.myproject.test.behavior.driver.annotations.BehaviorTest;
import org.jbehave.core.annotations.*;
import org.junit.runner.RunWith;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Scenario: Call the sample rest resource
*/
#RunWith(SpringJUnit4ClassRunner.class)
#BehaviorTest
public class SampleRestCallWithInvalidAccountSteps extends AbstractSpringJBehaveStory {
#Given("an initial value")
public void Given() {
// purposely empty
}
#When("this API is called")
public void When() {
// purposely empty
}
#Then("expect failure")
public void Then() {
// purposely empty
}
}
My story superclass:
package com.mycompany.myproject.test.behavior.driver;
import java.util.Arrays;
import org.jbehave.core.configuration.Configuration;
import org.jbehave.core.configuration.MostUsefulConfiguration;
import org.jbehave.core.embedder.Embedder;
import org.jbehave.core.embedder.EmbedderControls;
import org.jbehave.core.io.CodeLocations;
import org.jbehave.core.io.LoadFromClasspath;
import org.jbehave.core.io.StoryLoader;
import org.jbehave.core.io.StoryPathResolver;
import org.jbehave.core.io.UnderscoredCamelCaseResolver;
import org.jbehave.core.junit.JUnitStory;
import org.jbehave.core.reporters.FilePrintStreamFactory;
import org.jbehave.core.reporters.Format;
import org.jbehave.core.reporters.StoryReporterBuilder;
import org.jbehave.core.steps.InjectableStepsFactory;
import org.jbehave.core.steps.ParameterControls;
import org.jbehave.core.steps.spring.SpringStepsFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
public abstract class AbstractSpringJBehaveStory extends JUnitStory {
#Autowired
private ApplicationContext appContext;
public AbstractSpringJBehaveStory() {
Embedder embedder = new Embedder();
embedder.useEmbedderControls(embedderControls());
embedder.useMetaFilters(Arrays.asList("-skip"));
useEmbedder(embedder);
}
#Override
public InjectableStepsFactory stepsFactory() {
return new SpringStepsFactory(configuration(), appContext);
}
#Override
public Configuration configuration() {
return new MostUsefulConfiguration()
.useStoryPathResolver(storyPathResolver())
.useStoryLoader(storyLoader())
.useStoryReporterBuilder(storyReporterBuilder())
.useParameterControls(parameterControls());
}
private EmbedderControls embedderControls() {
return new EmbedderControls()
.doIgnoreFailureInStories(true)
.doGenerateViewAfterStories(true)
.doVerboseFailures(true);
}
private StoryPathResolver storyPathResolver() {
return new UnderscoredCamelCaseResolver();
}
private StoryLoader storyLoader() {
return new LoadFromClasspath();
}
private StoryReporterBuilder storyReporterBuilder() {
return new StoryReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromClass(this.getClass()))
.withPathResolver(new FilePrintStreamFactory.ResolveToPackagedName())
.withFailureTrace(true)
.withDefaultFormats()
.withFormats(Format.IDE_CONSOLE, Format.TXT, Format.HTML);
}
private ParameterControls parameterControls() {
return new ParameterControls()
.useDelimiterNamedParameters(true);
}
}
For reference, I was loosely following this guide.
I now have a working solution. I believe that I have narrowed the culprit to improperly extending AbstractSpringJBehaveStory in the SampleRestCallSteps class. I fixed this by creating a new empty class to serve as an instantiable subclass of AbstractSpringJBehaveStory and removing the extends from SampleRestCallSteps.
Also, I did find a few missing lines when creating the Configuration, which I believe is the real cause. I got the new ones that are now shown in the method below from generating a blank new JBehave-Spring archetype with maven.
#Override
public Configuration configuration() {
ParameterConverters parameterConverters = new ParameterConverters();
ExamplesTableFactory examplesTableFactory = new ExamplesTableFactory(
new LocalizedKeywords(),
new LoadFromClasspath(this.getClass()),
parameterConverters);
parameterConverters.addConverters(
new DateConverter(new SimpleDateFormat("yyyy-MM-dd")),
new ExamplesTableConverter(examplesTableFactory));
return new MostUsefulConfiguration()
.useStoryLoader(storyLoader())
.useStoryParser(new RegexStoryParser(examplesTableFactory))
.useStoryReporterBuilder(storyReporterBuilder())
.useStoryPathResolver(storyPathResolver())
.useParameterControls(parameterControls())
.useParameterConverters(parameterConverters);
}
Lastly, I think a Spring context was not being autowired properly, so I changed the stepsFactory() method like this (again copied from the maven template):
#Override
public InjectableStepsFactory stepsFactory() {
ApplicationContext appContext = new SpringApplicationContextFactory("jbehave-app-context.xml")
.createApplicationContext();
return new SpringStepsFactory(configuration(), appContext);
}

Maven runs test but it does not display results

I've just started working with maven and I can't figure out how to solve the problem I have. It seems to my java file is compiled and test starts but no result shows up.
Demo.java:
package tutorial2;
public class Demo {
public boolean getBool(){
return false;
}
}
TestDemo.java:
package tutorial2;
import static org.junit.Assert.*;
import org.junit.Test;
public class TestDemo {
#Test
public void shouldBe(){
Demo demo = new Demo();
assertTrue(demo.getBool());
}
}
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>lets.develop.withme</groupId>
<artifactId>tutorial2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Tutorial 02</name>
<description>My second tutorial</description>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project
I'm getting this on console:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutorial 02 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # tutorial2 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # tutorial2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # tutorial2 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # tutorial2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # tutorial2 ---
[INFO] Surefire report directory: /home/adam/workspaceJavaEE/tutorial2/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running tutorial2.TestDemo
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.943 s
[INFO] Finished at: 2016-10-14T00:34:25+02:00
[INFO] Final Memory: 10M/212M
[INFO] ------------------------------------------------------------------------
Solved:
I solved problem by myself. Dependency in xml file was not configured properly. Version of junit dependency was wrong so It could't be run by maven.
Advise:
You should always add dependencies by "Insert Dependency" menu. It can be displayed by using shortcut "crtl"+"space" when your cursor is between <dependency> and </dependency> in your xml file. When you in "Select Dependency" menu enter "junit" in "Enter..." textbox and choose your version of junit. After clicking "ok" your dependency will be automatically added. This helps avoid problem with incorrect version typed manually.
By default, Surefire (the plugin that runs during mvn test) looks for classes in target/test-classes (which are compiled from src/test/java and maybe other places) that end in Test. Your class name is TestDemo, which doesn't end in Test, and won't be run. Either rename it to DemoTest (preferable), or manually configure Surefire in <plugins> (the approach when you're using a framework with alternate naming conventions, such as Spock's *Spec).
According to maven documentation avalible on:
By default, the Surefire Plugin will automatically include all test
classes with the following wildcard patterns:
"/Test*.java" - includes all of its subdirectories and all Java
filenames that start with "Test". "/*Test.java" - includes all of
its subdirectories and all Java filenames that end with "Test".
"/*TestCase.java" - includes all of its subdirectories and all Java
filenames that end with "TestCase".

Stanford CoreNLP version change in pom.xml causing error

I am using Stanford CoreNLP on Ubuntu 14.04 and facing the following issue when I run the following code:
Java Code:
package com.mycompany.app;
import java.io.*;
import java.util.*;
/*import edu.stanford.nlp.ling.HasWord;
import edu.stanford.nlp.ling.TaggedWord;
import edu.stanford.nlp.parser.shiftreduce.ShiftReduceParser;
import edu.stanford.nlp.process.DocumentPreprocessor;
import edu.stanford.nlp.parser.lexparser.ExhaustivePCFGParser;
import edu.stanford.nlp.trees.Tree;*/
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
public class App
{
public static void main(String[] args) throws Exception, NoClassDefFoundError
{
MaxentTagger tagger = null;
if(tagger == null)
{
tagger = new MaxentTagger("mymodel.tagger");
}
System.out.println("Let's do this!");
}
}
Command Run:
mvn clean install exec:java -Dexec.mainClass=com.mycompany.app.App
Terminal Output:
[INFO]
[INFO] --- maven-jar-plugin:2.2:jar (default-jar) # dt_mvn ---
[INFO] Building jar: /home/sidharth/Desktop/dt_mvn/target/dt_mvn-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.3:install (default-install) # dt_mvn ---
[INFO] Installing /home/sidharth/Desktop/dt_mvn/target/dt_mvn-1.0-SNAPSHOT.jar to /home/sidharth/.m2/repository/com/mycompany/app/dt_mvn/1.0-SNAPSHOT/dt_mvn-1.0-SNAPSHOT.jar
[INFO] Installing /home/sidharth/Desktop/dt_mvn/pom.xml to /home/sidharth/.m2/repository/com/mycompany/app/dt_mvn/1.0-SNAPSHOT/dt_mvn-1.0-SNAPSHOT.pom
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) # dt_mvn ---
Reading POS tagger model from mymodel.tagger ... [WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)
Caused by: edu.stanford.nlp.io.RuntimeIOException: java.io.StreamCorruptedException: invalid stream header: 00048E4D
at edu.stanford.nlp.maxent.iis.LambdaSolve.read_lambdas(LambdaSolve.java:726)
at edu.stanford.nlp.tagger.maxent.LambdaSolveTagger.<init>(LambdaSolveTagger.java:76)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:863)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:767)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.<init>(MaxentTagger.java:298)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.<init>(MaxentTagger.java:263)
at com.mycompany.app.App.main(App.java:22)
... 6 more
Caused by: java.io.StreamCorruptedException: invalid stream header: 00048E4D
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
at edu.stanford.nlp.maxent.iis.LambdaSolve.read_lambdas(LambdaSolve.java:719)
... 12 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.260s
[INFO] Finished at: Sun Dec 20 01:34:29 IST 2015
[INFO] Final Memory: 23M/228M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project dt_mvn: An exception occured while executing the Java class. null: InvocationTargetException: java.io.StreamCorruptedException: invalid stream header: 00048E4D -> [Help 1]
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>dt_mvn</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>dt_mvn</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>3.5.2</version>
</dependency>
</dependencies>
</project>
However, changing version in pom.xml from 3.5.2 to 1.3.0 works correctly. What could be the reason for this?
Thanks!
P.S.
If it's of any use, the maven project was created by the following command:
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=dt_mvn -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
I suspect however you built "mymodel.tagger" is incompatible with later versions so the deserialization is failing. What version did you use to build my_model.tagger? Does your Maven project fail if you use 1.3.5 ? I can see changes in our repo in LambdaSolve.java involving serialization in the time period between 1.3.1 and 1.3.5 so I suspect that is the reason.
Also make sure you use Java 1.8 with Stanford CoreNLP 3.5.0 or later.

Maven exec plugin main class missing

I'm trying to go through Hibernate tutorial and got stuck on running the command
C:\Users\Eyal\workspace\FirstHibernateTutorial>mvn exec:java -Dexec.mainclass="o
rg.hsqldb.Server" -Dexec.args="-database.O file:target/data/tutorial" -e
and get these errors.
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT
[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artif
actId} instead.
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building First Hibernate Tutorial 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> exec-maven-plugin:1.2:java (default-cli) # hibernate-tutorial >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2:java (default-cli) # hibernate-tutorial <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2:java (default-cli) # hibernate-tutorial ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.964s
[INFO] Finished at: Thu Apr 21 18:31:10 IDT 2011
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:java (def
ault-cli) on project hibernate-tutorial: The parameters 'mainClass' for goal org
.codehaus.mojo:exec-maven-plugin:1.2:java are missing or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.codehaus.mojo:exec-maven-plugin:1.2:java (default-cli) on project hibernate-t
utorial: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin
:1.2:java are missing or invalid
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:221)
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.buildProje
ct(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'mai
nClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2:java are missing or inv
alid
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePl
uginFields(DefaultMavenPluginManager.java:576)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfigu
redMojo(DefaultMavenPluginManager.java:529)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:92)
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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParamete
rException
I did changed one thing in the pom file. I added the versions of the dependencies. this is the pom.xml. I changed it because without it, I'm getting errors about lack of version specification.
<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>org.hibernate.tutorials</groupId>
<artifactId>hibernate-tutorial</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>First Hibernate Tutorial</name>
<build>
<!-- we dont want the version to be part of the generated war file name -->
<finalName>${artifactId}</finalName>
</build>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.3.1.GA</version>
</dependency>
<!-- Because this is a web app, we also have a dependency on the servlet api. -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>[2.4,)</version>
</dependency>
<!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.5.6</version>
</dependency>
<!-- Hibernate gives you a choice of bytecode providers between cglib and javassist -->
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>[3.0,)</version>
</dependency>
</dependencies>
</project>
I think the main problem is in the line
The parameters 'mainClass' for goal org
.codehaus.mojo:exec-maven-plugin:1.2:java are missing or invalid -> [Help 1]
Why does mainClass is not valid?
Can you see something I don't?
EDIT:
OK, I changed "mainclass" to "mainClass" and it gives me this error about not finding "org.hsqldb.Server". I added hsqldb.jar to Eclipse' reference libraries but still it gives me the same error.
This is the stack print:
C:\Users\Eyal\workspace\FirstHibernateTutorial>mvn exec:java -Dexec.mainClass="o
rg.hsqldb.Server" -Dexec.args="-database.O file:target/data/tutorial" -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT
[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artif
actId} instead.
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building First Hibernate Tutorial 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> exec-maven-plugin:1.2:java (default-cli) # hibernate-tutorial >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2:java (default-cli) # hibernate-tutorial <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2:java (default-cli) # hibernate-tutorial ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.106s
[INFO] Finished at: Sat Apr 23 10:46:09 IDT 2011
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:java (def
ault-cli) on project hibernate-tutorial: An exception occured while executing th
e Java class. org.hsqldb.Server -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.codehaus.mojo:exec-maven-plugin:1.2:java (default-cli) on project hibernate-t
utorial: An exception occured while executing the Java class. org.hsqldb.Server
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.buildProje
ct(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured
while executing the Java class. org.hsqldb.Server
at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:346)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
... 19 more
Caused by: java.lang.ClassNotFoundException: org.hsqldb.Server
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:284)
at java.lang.Thread.run(Thread.java:662)
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
C:\Users\Eyal\workspace\FirstHibernateTutorial>
It should be mainClass not mainclass.
-Dexec.mainClass="org.hsqldb.Server"
Read more on this here and here.
And hsqldb should be in your maven dependencies:
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.0.0</version>
</dependency>
Please be aware, that the "configuration" section must be out of the execution section (see example below). Otherwise you get the "missing or invalid mainClass" error.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<dependencies>
<dependency>
<groupId>org.versly</groupId>
<artifactId>versly-wsdoc</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.versly.rest.wsdoc.RestDocAssembler</mainClass>
<arguments>
<argument>${project.build.directory}/classes</argument>
</arguments>
</configuration>
</plugin>

Categories

Resources