File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven in Spring test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven in Spring test" Watch "Maven in Spring test" New topic

Maven in Spring test

pkinuk Buler
Ranch Hand

Joined: May 22, 2009
Posts: 63
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:

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(
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(
at org.junit.internal.runners.JUnit4ClassRunner$
at org.junit.internal.runners.ClassRoadie.runUnprotected(
at org.junit.internal.runners.ClassRoadie.runProtected(
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(
at org.apache.maven.surefire.booter.SurefireBooter.main(

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/

The following two classes stored in src/main/java/

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: 63
Sorry, I copied the wrong artifact ID, please use 'aspectJHello' as the artifactID in the Maven quick start command.
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

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: 63
Sorry angain. I copied wrong again。 Here is the right command:

Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

--DartifactId? Not -D?
Dhivya Alex

Joined: Apr 09, 2014
Posts: 1
Dont know if anyuone is still facing issues with this.

You are using older spring. You will need spring 3 or above for junit4


Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10441

Dhivya, welcome to CodeRanch and thank you for posting that probable solution!

[My Blog] [JavaRanch Journal]
I agree. Here's the link:
subject: Maven in Spring test
It's not a secret anymore!