mvn test 的问题

25 views
Skip to first unread message

宇然 赵

unread,
Feb 18, 2012, 9:54:50 PM2/18/12
to Maven中文
本人刚接触maven 不久,遇到了一下问题想请教一下各位大牛。
1. surfire 默认使用juint 3.8? ,我在pom 中配置了junit版本为4.8,我在pom 中配置了surfire 使用
4.8版本的junit
我项目中使用了 spring -test的包 ,但是根据 第一原则,maven应该自动下载4.8的包。现在我mvn test 却出现如下问


-------------------------------------------------------------------------------
Test set: edu.hzsf.storm.dal.dao.daoibatis.UserDAOTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 10.678
sec <<< FAILURE!
testGetUser(edu.hzsf.storm.dal.dao.daoibatis.UserDAOTest) Time
elapsed: 10.328 sec <<< ERROR!
java.lang.NoSuchMethodError:
org.springframework.core.MethodParameter.getParameterAnnotations()
[Ljava/lang/Object;
at
org.springframework.beans.factory.config.DependencyDescriptor.getAnnotations(DependencyDescriptor.java:
203)
at
org.springframework.beans.factory.annotation.QualifierAnnotationAutowireCandidateResolver.isAutowireCandidate(QualifierAnnotationAutowireCandidateResolver.java:
106)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.isAutowireCandidate(DefaultListableBeanFactory.java:
377)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.isAutowireCandidate(DefaultListableBeanFactory.java:
364)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:
670)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:
610)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:
1076)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:
982)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:
329)
at
org.springframework.test.AbstractDependencyInjectionSpringContextTests.injectDependencies(AbstractDependencyInjectionSpringContextTests.java:
208)
at
org.springframework.test.AbstractDependencyInjectionSpringContextTests.prepareTestInstance(AbstractDependencyInjectionSpringContextTests.java:
183)
at
org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:
103)
at junit.framework.TestCase.runBare(TestCase.java:132)
at
org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:
79)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:
83)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:
53)
at
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:
123)
at
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:
104)
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.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:
164)
at org.apache.maven.surefire.booter.ProviderFactory
$ProviderProxy.invoke(ProviderFactory.java:110)
at
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:
175)
at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:
107)
at
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:
68)


请教一下各位这是怎么回事?

Tony Deng

unread,
Feb 20, 2012, 2:19:37 AM2/20/12
to mave...@googlegroups.com
将你的pom.xml贴上来看看。

2012/2/19 宇然 赵 <meran5...@gmail.com>:

> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的"Maven中文"论坛。
> 要向此网上论坛发帖,请发送电子邮件至 mave...@googlegroups.com
> 要取消订阅此网上论坛,请发送电子邮件至 maven-zh+u...@googlegroups.com
> 若有更多问题,请通过 http://groups.google.com/group/maven-zh?hl=zh-CN 访问此网上论坛。
>

--
Tony Deng
E-mail: wolf...@gmail.com
FriendFeed: http://freindfeed.com/tonydeng
Twitter: http://twitter.com/wolfdeng
Blog: http://wolfchina.blogbus.com/

Reply all
Reply to author
Forward
0 new messages