| Author |
Maven in Spring test
|
pkinuk Buler
Ranch Hand
Joined: May 22, 2009
Posts: 57
|
|
Hi all,
I learned the Maven & Spring a few days ago.
I used Eclipse to run the test class called TestSpring and it passed. It also passed if run the mvn clean compile. However, it failed when I run Maven command in Eclipse. It showed the following error messages:
Running com.xyz.myapp.domain.TestSpring
org.apache.maven.surefire.booter.SurefireExecutionException: org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V; nested exception is java.lang.NoSuchMethodError: org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V
java.lang.NoSuchMethodError: org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:155)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:61)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:54)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:52)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
The Maven command I used to create the project
The pom.xml file
Here is my test class:
Here is the test xml which stored in src/test/java/com.xyz.myapp.domain
The following two classes stored in src/main/java/com.xyz.myapp.domain
Anyone can tell me why? Thank you in advance.
|
 |
Hongli Li
Ranch Hand
Joined: Oct 29, 2006
Posts: 124
|
|
|
artifactId=spring-hello is in your maven archetype:generate command, and why in pom.xml. you have <artifactId>aspectJHello</artifactId> <name>aspectJHello</name>
|
Do you know why this cup is useful? Because it is empty.
|
 |
pkinuk Buler
Ranch Hand
Joined: May 22, 2009
Posts: 57
|
|
|
Sorry, I copied the wrong artifact ID, please use 'aspectJHello' as the artifactID in the Maven quick start command.
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
|
You're also missing the -D when specifying the version
|
Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
|
 |
pkinuk Buler
Ranch Hand
Joined: May 22, 2009
Posts: 57
|
|
Sorry angain. I copied wrong again。 Here is the right command:
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
|
--DartifactId? Not -D?
|
 |
 |
|
|
subject: Maven in Spring test
|
|
|