【发布时间】:2016-01-27 17:44:50
【问题描述】:
我 have a test failure 由于来自 Platform.getPlugin("...") 的 IllegalStateException 调用 @Deprecated org.eclipse.core.runtime.Platform.getPluginRegistry() “仅在安装兼容层时才有效,否则不得使用。”
此测试在开发期间可在工作空间中运行,但在由 Maven Tycho Surefire 运行时会失败(可重现)。我收集到这与org.eclipse.core.runtime.compatibility 有关,因此尝试在pom.xml 中执行此操作:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
...
<dependencies>
<dependency>
<type>p2-installable-unit</type>
<artifactId>org.eclipse.core.runtime.compatibility</artifactId>
</dependency>
</dependencies>
<bundleStartLevel>
<bundle>
<id>org.eclipse.core.runtime.compatibility</id>
<level>4</level>
<autoStart>true</autoStart>
</bundle>
</bundleStartLevel>
</configuration>
不幸的是,即使有了这个(上面)它仍然无法正常工作 - 我做错了什么?
作为解决此问题的替代答案,我想我可以尝试在测试中调整该行以使用除已弃用的 Platform.getPlugin() 之外的其他 API - 但是您如何获得给定的 org.eclipse.core.runtime.Plugin没有使用任何需要此兼容层的已弃用 API 的 ID,这会导致我出现问题?
【问题讨论】:
标签: eclipse-plugin tycho e4 tycho-surefire-plugin