在为 SnapLogic 自定义快照设置 JUnit 时获取 java.lang.NoSuchMethodError

Getting java.lang.NoSuchMethodError while setting up JUnits for SnapLogic custom snaps

我想在 SnapLogic 中创建自己的快照。

我通过 运行 下载了示例项目:

$ mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeCatalog=http://maven.clouddev.snaplogic.com:8080/nexus/content/repositories/master/

但是,当我构建这个项目时,我收到以下在 JUnit 中失败的错误:

C:\Java\jdk1.8.0_141\bin\java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:53596,suspend=y,server=n -ea -Didea.test.cyclic.buffer.size=1048576 -Dfile.encoding=UTF-8 -classpath C:\Users\kqvx285\AppData\Local\Temp\classpath.jar com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.snaplogic.snaps.TwoInputsTwoOutputsTest
Connected to the target VM, address: '127.0.0.1:53596', transport: 'socket'

java.lang.NoSuchMethodError: com.snaplogic.snap.api.OutputViewsImpl.add(Lcom/snaplogic/snap/view/OutputView;)

V

at com.snaplogic.snap.test.harness.TestResultImpl.addOutputView(TestResultImpl.java:116)
at com.snaplogic.snap.test.harness.TestSetupImpl.addOutputView(TestSetupImpl.java:393)
at com.snaplogic.snap.test.harness.SnapExecutor.createOutputViewFor(SnapExecutor.java:845)
at com.snaplogic.snap.test.harness.SnapExecutor.evaluate(SnapExecutor.java:426)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access[=12=]0(ParentRunner.java:53)
at org.junit.runners.ParentRunner.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Disconnected from the target VM, address: '127.0.0.1:53596', transport: 'socket'

Process finished with exit code -1

这可能与过时的依赖关系有关。您可以尝试删除本地 Maven 存储库中的 com/snaplogic 文件夹然后重建吗?

例如rm -rf ~/.m2/repository/com/snaplogic/