我正在构建一个小的 maven 应用程序,但我遇到了黄瓜测试问题。这是出现的错误:java.lang.NoSuchMethodError: org.glassfish.hk2.utilities.general.GeneralUtilities.getSystemProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; at org.jvnet.hk2.internal.ServiceLocatorImpl.<clinit>(ServiceLocatorImpl.java:122) at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.initialize(ServiceLocatorGeneratorImpl.java:66) at org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.create(ServiceLocatorGeneratorImpl.java:96) at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.internalCreate(ServiceLocatorFactoryImpl.java:312) at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:293) at org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:157) at org.glassfish.hk2.utilities.ServiceLocatorUtilities.bind(ServiceLocatorUtilities.java:205) at org.glassfish.hk2.utilities.ServiceLocatorUtilities.bind(ServiceLocatorUtilities.java:220) at cucumber.runtime.java.hk2.impl.HK2Factory.start(HK2Factory.java:40) at cucumber.runtime.java.JavaBackend.buildWorld(JavaBackend.java:125) at cucumber.runtime.Runtime.buildBackendWorlds(Runtime.java:139) at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:38) at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91) at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63) at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)我很确定我的依赖项有问题,但我似乎找不到问题,这是运行 mvn dependency:tree 的结果
1 回答
Smart猫小萌
TA贡献1911条经验 获得超7个赞
你有两个不同版本的 hk2,第一个从这里传递过来:
[INFO] +- com.sac.enax.test:enax_bdd_test_core:jar:1.1.7:compile [INFO] | +- org.glassfish.hk2:hk2:jar:2.4.0-b06:compile
第二个作为这里的直接依赖:
[INFO] +- org.glassfish.hk2:hk2-api:jar:2.5.0-b61:test [INFO] | +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b61:compile
该方法org.glassfish.hk2.utilities.general.GeneralUtilities.getSystemProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
在 hk2-utils 版本中存在2.4.0-b06
,但在 version 之前被删除2.5.0-b61
。编辑您的 pom 以将显式声明的依赖项调整为2.4.0-b06
,或者将旧版本拉到更新版本的中间依赖项。
添加回答
举报
0/150
提交
取消