java - Exception with surefire plugin with test phase in maven -


i need use surefire v2.12, attached stack trace every time run version. if run v2.10 not error. need version can annotate test classes @category , label them either unittests or integrationtests. here's command: mvn test -dsurefire.version=2.12 -x

 [error] failed execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project project: execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test failed: java.lang.reflect.invocationtargetexception; nested exception java.lang.reflect.invocationtargetexception: null: exceptionininitializererror: unexpected classnotfoundexception looking class 'org.apache.maven.cli.mavencli' -> [help 1] org.apache.maven.lifecycle.lifecycleexecutionexception: failed execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project aspen: execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test failed: java.lang.reflect.invocationtargetexception; nested exception java.lang.reflect.invocationtargetexception: null @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:225) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:153) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:145) @ org.apache.maven.lifecycle.internal.lifecyclemodulebuilder.buildproject(lifecyclemodulebuilder.java:84) @ org.apache.maven.lifecycle.internal.lifecyclemodulebuilder.buildproject(lifecyclemodulebuilder.java:59) @ org.apache.maven.lifecycle.internal.lifecyclestarter.singlethreadedbuild(lifecyclestarter.java:183) @ org.apache.maven.lifecycle.internal.lifecyclestarter.execute(lifecyclestarter.java:161) @ org.apache.maven.defaultmaven.doexecute(defaultmaven.java:320) @ org.apache.maven.defaultmaven.execute(defaultmaven.java:156) @ org.apache.maven.cli.mavencli.execute(mavencli.java:537) @ org.apache.maven.cli.mavencli.domain(mavencli.java:196) @ org.apache.maven.cli.mavencli.main(mavencli.java:141) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ org.codehaus.plexus.classworlds.launcher.launcher.launchenhanced(launcher.java:290) @ org.codehaus.plexus.classworlds.launcher.launcher.launch(launcher.java:230) @ org.codehaus.plexus.classworlds.launcher.launcher.mainwithexitcode(launcher.java:409) @ org.codehaus.plexus.classworlds.launcher.launcher.main(launcher.java:352) caused by: org.apache.maven.plugin.pluginexecutionexception: execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test failed: java.lang.reflect.invocationtargetexception; nested exception java.lang.reflect.invocationtargetexception: null @ org.apache.maven.plugin.defaultbuildpluginmanager.executemojo(defaultbuildpluginmanager.java:110) @ org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:209) ... 19 more caused by: org.apache.maven.surefire.util.surefirereflectionexception: java.lang.reflect.invocationtargetexception; nested exception java.lang.reflect.invocationtargetexception: null @ org.apache.maven.surefire.util.reflectionutils.invokemethodwitharray(reflectionutils.java:197) @ org.apache.maven.surefire.util.reflectionutils.invokegetter(reflectionutils.java:69) @ org.apache.maven.surefire.booter.providerfactory$providerproxy.getsuites(providerfactory.java:148) @ org.apache.maven.plugin.surefire.booterclient.forkstarter.getsuitesiterator(forkstarter.java:317) @ org.apache.maven.plugin.surefire.booterclient.forkstarter.runsuitesforkpertestset(forkstarter.java:149) @ org.apache.maven.plugin.surefire.booterclient.forkstarter.run(forkstarter.java:118) @ org.apache.maven.plugin.surefire.abstractsurefiremojo.executeprovider(abstractsurefiremojo.java:199) @ org.apache.maven.plugin.surefire.abstractsurefiremojo.executeallproviders(abstractsurefiremojo.java:176) @ org.apache.maven.plugin.surefire.abstractsurefiremojo.executeafterpreconditionschecked(abstractsurefiremojo.java:135) @ org.apache.maven.plugin.surefire.abstractsurefiremojo.execute(abstractsurefiremojo.java:98) @ org.apache.maven.plugin.defaultbuildpluginmanager.executemojo(defaultbuildpluginmanager.java:101) ... 20 more caused by: java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ org.apache.maven.surefire.util.reflectionutils.invokemethodwitharray(reflectionutils.java:189) ... 30 more caused by: java.lang.exceptionininitializererror ... 2 more @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:169) @ org.junit.runner.description.gettestclass(description.java:207) @ org.apache.maven.surefire.common.junit48.filterfactory$groupmatchercategoryfilter.shouldrun(filterfactory.java:207) @ org.apache.maven.surefire.junitcore.junitcoreprovider.getsuitesaslist(junitcoreprovider.java:169) @ org.apache.maven.surefire.junitcore.junitcoreprovider.getsuites(junitcoreprovider.java:102) ... 35 more caused by: java.lang.runtimeexception: unexpected classnotfoundexception looking class 'org.apache.maven.cli.mavencli' ... 12 more (deleted lines here) 

my pom.xml

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactid>sample</artifactid> <groupid>sample</groupid> <version>1.0</version> </parent> <modelversion>4.0.0</modelversion> <artifactid>webapp</artifactid> <packaging>war</packaging> <dependencies> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>${org.slf4j-version}</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>${org.slf4j-version}</version> </dependency> <dependency> <groupid>org.mockito</groupid> <artifactid>mockito-all</artifactid> <version>1.9.0</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.10</version> </dependency> </dependencies> <reporting> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>findbugs-maven-plugin</artifactid> <version>2.5.1</version> </plugin> </plugins> </reporting> <build> <plugins> <plugin> <artifactid>maven-surefire-plugin</artifactid> <dependencies> <dependency> <groupid>org.apache.maven.surefire</groupid> <artifactid>surefire-junit47</artifactid> <version>${surefire.version}</version> <scope>test</scope> </dependency> </dependencies> <configuration> <groups>com.webapp.api.annotation.type.${group.include}</groups> <excludedgroups>com.webapp.api.annotation.type.${group.exclude}</excludedgroups> </configuration> </plugin> </plugins> </build> </project> 

also, able in different project set scrap. in case can see overwriting surefire plugin version.

any ideas?

thanks

why not putting versions pom, cause pom controlled , else ever use project astonished not work, cause missed give properties on command line. btw: have checked output via mvn -x -dsurefire.version=2.12 etc. think same error message.

i have rechecked , if define version in way project not correct anymore if miss options (-d...) on command line things this:

info] scanning projects... [error] build not read 1 project -> [help 1] [error] [error] project com.soebes.katas:code:1.0-snapshot (/home/katas/pom.xml) has 1 error [error] 'build.plugins.plugin.version' org.apache.maven.plugins:maven-surefire-plugin must valid version '${surefire.version}'. @ line 36, column 20 [error] [error] see full stack trace of errors, re-run maven -e switch. [error] re-run maven using -x switch enable full debug logging. [error] [error] more information errors , possible solutions, please read following articles: [error] [help 1] http://cwiki.apache.org/confluence/display/maven/projectbuildingexception 

in other words real bad idea define plugin versions (or dependencies of it) via options on command line. recommend define version of need pom , make correct use of unit- , integration tests via surefire and/or failsafe plugin. solve problems.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -