Eclipse运行时本身被分解成几个包:
- org.eclipse.core.contenttype - Content type mechanism
- org.eclipse.core.jobs - Concurrency infrastructure
- org.eclipse.core.net - Network and proxy management infrastructure
- org.eclipse.equinox.app - Application Model
- org.eclipse.equinox.common - Common basic functionality
- org.eclipse.equinox.preferences - Runtime preferences
- org.eclipse.equinox.registry - Extension registry
- org.eclipse.equinox.security - Security infrastructure
- org.eclipse.core.runtime - Aggregates the Eclipse runtime bundles into a single capability that can be depended on
如果您的插件依赖于org.eclipse.core.runtime包,那么它将继续不变地运行。
然而,如果您希望最小化依赖项的数量,那么您可以只选择使用的运行时包。
对运行时包的依赖可以使用Import-Package或Require-Bundle来声明
如果您想使用Import-Package头(而不是Require-Bundle),那么您应该注意org.eclipse.core.runtime包被分割成几个包。
导出拆分包的一部分的捆绑包使用一个强制指令。
强制指令要求导入者指定额外的匹配属性,以便成功连接到导出的包。
例如,要只导入org.eclipse.equinox.common bundle提供的包的内容,请使用清单文件中的这一行:
Import-Package: org.eclipse.core.runtime; common="split"
从org.eclipse.equinox导入包的内容。
registry和org.eclipse.equinox.common bundle,使用:
Import-Package: org.eclipse.core.runtime; registry="split"
上面的示例分别使用了强制匹配属性common和registry。
这允许bundle被解析到拆分包中所需的部分。
要导入完整的包,请不要使用任何匹配的属性:
Import-Package: org.eclipse.core.runtime
这将解析为由org.eclipse.core.runtime聚合包导出的完整包。