【发布时间】:2011-12-16 12:24:20
【问题描述】:
对于我的 Eclipse 插件项目,我定义了以下目标平台:
<location includeAllPlatforms="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.equinox.executable.feature.group" version="3.5.0.v20110530-7P7NFUFFLWUl76mart"/>
<unit id="org.eclipse.rcp.sdk.id" version="3.7.1.M20110909-1335"/>
<unit id="org.eclipse.jdt.feature.group" version="3.7.1.r371_v20110810-0800-7z8gFcoFMLfTabvKsR5Qm9rBGEBK"/>
<unit id="epp.package.java" version="1.4.1.20110909-1818"/>
...
我的插件有 JUnit 插件测试(在同一个插件中)。如果我尝试使用 JUnit 启动配置 (org.eclipse.platform.ide) 运行它们,我会收到以下关于 junit 的控制台消息和一个异常:
!ENTRY org.eclipse.osgi 2 0 2011-12-16 13:00:35.206
!MESSAGE One or more bundles are not resolved because the following root constraints are not resolved:
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-12-16 13:00:35.206
!MESSAGE Bundle reference:file:/Users/stolz/ws-bucky/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.jdt.junit4.runtime_1.1.200.v20110505-0800.jar was not resolved.
!SUBENTRY 2 org.eclipse.jdt.junit4.runtime 2 0 2011-12-16 13:00:35.206
!MESSAGE Missing required bundle org.junit_4.7.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-12-16 13:00:35.207
!MESSAGE Bundle reference:file:/Users/stolz/ws-bucky/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.junit4_4.8.1.v20100525/ was not resolved.
!SUBENTRY 2 org.junit4 2 0 2011-12-16 13:00:35.207
!MESSAGE Missing required bundle org.junit_4.8.1.
和
!SUBENTRY 1 org.eclipse.osgi 2 0 2011-12-16 13:00:35.234
!MESSAGE Bundle org.junit4_4.8.1.v20100525 [219] was not resolved.
!SUBENTRY 2 org.junit4 2 0 2011-12-16 13:00:35.235
!MESSAGE Missing required bundle org.junit_4.8.1.
!ENTRY org.eclipse.core.net 1 0 2011-12-16 13:00:39.889
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences
Exception in thread "Plug-in Tests Runner" java.lang.IllegalArgumentException: Bundle "org.eclipse.jdt.junit4.runtime" not found. Possible causes include missing dependencies, too restrictive version ranges, or a non-matching required execution environment.
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.getClassLoader(RemotePluginTestRunner.java:77)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.readPluginArgs(RemotePluginTestRunner.java:93)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.init(RemotePluginTestRunner.java:83)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:61)
at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness$1.run(PlatformUITestHarness.java:47)
at java.lang.Thread.run(Thread.java:680)
使用默认的 JDT 安装,单元测试运行良好,只是我想为 Hudson 构建定义一个合适的目标平台。不用说,我尝试在各个地方添加对两个违规平台的依赖,但无济于事。
更新: 糟糕,我将此与另一组测试混淆了;这里的这些不是无头的,而是工作台测试。
另一个奇怪的是,有时我在切换到默认 Eclipse 平台并返回我的平台后第一次运行测试时不会看到此错误。奇怪。
【问题讨论】:
-
你在用什么“他们用一个无头的 JUnit 启动配置”?您的意思是从命令行无头启动它们还是使用“无应用程序 - 无头模式”?
-
@PaulWebster 告诉我,测试根本不是无头的,而是工作台测试。我已经更新了问题。
-
你的目标平台至少需要org.eclipse.rcp.feature.group、org.eclipse.platform.feature.group和org.eclipse.jdt.feature.group,对吧?
-
@PaulWebster 我添加了 rcp 和平台功能组,但行为(以及插件总数)没有改变。还要注意我在更新中提到的奇怪之处。
标签: eclipse junit eclipse-plugin