1

我一直在尝试在我的 JUnit 测试中使用 ShrinkWrap 解决 maven 的依赖关系,但我遇到了一个无法解决的问题。按照我的测试:

PomEquippedResolveStage pom = Maven.resolver().loadPomFromFile("pom.xml")
.importDependencies(ScopeType.PROVIDED, ScopeType.RUNTIME, ScopeType.COMPILE, ScopeType.TEST);

//This error ocurred when I tried to execute the using method
pom.resolve().using(TransitiveStrategy.INSTANCE).asFile()

这就是我遇到的问题:

java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.WebArchive br.com.sulamerica.susis.autorizador.ws.resource.BeneficiarioResourceTest.createDeployment()  at 
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:177)     at 
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generateDeployment(AnnotationDeploymentScenarioGenerator.java:99)  at 
org.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.generate(AnnotationDeploymentScenarioGenerator.java:62)    at 
org.jboss.arquillian.container.test.impl.client.deployment.DeploymentGenerator.generateDeployment(DeploymentGenerator.java:79)  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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)    at 
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)   at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)    at 
org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)   at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)     at     
org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:100)     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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)    at     
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)   at     
org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)    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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)    at 
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)   at 
org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.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.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)    at 
org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)   at 
org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)   at 
org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)   at 
org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:80)   at 
org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:182)   at 
org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)     at 
org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)    at 
org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)   at 
org.junit.runners.ParentRunner.run(ParentRunner.java:309)   at 
org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)  at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)     at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)  at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)  at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)  at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)   at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.reflect.InvocationTargetException   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.jboss.arquillian.container.test.impl.client.deployment.AnnotationDeploymentScenarioGenerator.invoke(AnnotationDeploymentScenarioGenerator.java:173)     ... 50 more 
Caused by: java.lang.NoSuchMethodError: org.apache.maven.artifact.repository.metadata.Versioning.getSnapshotVersions()Ljava/util/List;  at 
org.apache.maven.repository.internal.DefaultVersionResolver.merge(DefaultVersionResolver.java:399)  at 
org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion(DefaultVersionResolver.java:240)     at 
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:250)  at 
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)   at 
org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)   at 
org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)   at 
org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:333)     at 
org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.MavenRepositorySystem.resolveDependencies(MavenRepositorySystem.java:122)    at 
org.jboss.shrinkwrap.resolver.impl.maven.MavenWorkingSessionImpl.resolveDependencies(MavenWorkingSessionImpl.java:251)  at 
org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.using(MavenStrategyStageBaseImpl.java:67)   at 
org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.withoutTransitivity(MavenStrategyStageBaseImpl.java:54)     at 
org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.withoutTransitivity(MavenStrategyStageBaseImpl.java:38)     at 
br.com.sulamerica.susis.autorizador.ws.resource.BeneficiarioResourceTest.createDeployment(BeneficiarioResourceTest.java:102)    ... 55 more 

有谁知道我能做些什么来解决这个问题?

谢谢

4

0 回答 0