我正在構建一個小的 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
提交
取消