我对这个错误感到困惑:
当我查看插件依赖关系时,我可以看到
Xtext 2.4.3 是否与 JUnit 4.11 兼容,或者我必须将我的 Eclipse 安装降级到 JUnit 4.10?
java.lang.NoClassDefFoundError: junit/framework/TestCase
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(DefaultClassLoader.java:188)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClassHoldingLock(ClasspathManager.java:638)
...
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
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.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62)
at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23)
...
Caused by: java.lang.ClassNotFoundException: junit.framework.TestCase cannot be found by org.eclipse.xtext.junit_2.4.3.v201309030823
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 78 more
当我运行我的 Xtext DSL 的插件测试时(即在内部启动新的 Eclipse 平台时),我遇到了异常。这发生在我的任何代码被执行之前。当我查看插件依赖关系时,我可以看到
org.junit_4.11.0.v201303080030.jar
在类路径上,而且我还看到 /.../workspace/.metadata/.plugins/org.eclipse.pde.core/.external_libraries/org.junit_4.11.0.v201303080030/junit.jar
因此,OSGi 肯定能够解析此依赖项。Xtext 2.4.3 是否与 JUnit 4.11 兼容,或者我必须将我的 Eclipse 安装降级到 JUnit 4.10?