我为Eclipse Oxygen 3a编写了自己的Eclipse插件。它在Eclipse Oxygen 3a中完美运行。
现在,我需要在较新版本的Eclipse中部署相同的插件,但是例如在Eclipse Photon中安装插件时,安装窗口会显示:
Cannot perform operation. Computing alternate solutions, may take a while: ...
确实需要很长时间,最后说我的插件将不会安装。
如何使此插件可用于多个Eclipse版本?
按照要求,这是Require-Bundle:
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.jface.text,
org.eclipse.core.resources,
org.eclipse.ui.editors,
org.eclipse.ui.views;bundle-version="3.8.0",
org.eclipse.ui.ide,
org.eclipse.jdt.ui;bundle-version="3.13.52",
org.eclipse.jdt.core;bundle-version="3.13.50"
没有导入包。
feature.xml文件可以在下面看到。我在内部Apache Web服务器中部署了一个插件站点,并使用Eclipse的“帮助”菜单中的“安装新软件”选项从thare安装。
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="MyPluginFeature"
label="MyPlugin"
version="0.4.0"
provider-name="MyPlugin.com"
plugin="MyPlugin">
<description url="http://www.example.com/description">
</description>
<copyright url="http://www.example.com/copyright">
</copyright>
<license url="http://www.example.com/license">
</license>
<url>
<update label="MyPlugin site" url="http://acme.com/myplugin"/>
</url>
<requires>
<import plugin="org.eclipse.core.expressions" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.core.filesystem" version="1.3.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.12.0" match="compatible"/>
<import plugin="org.eclipse.core.resources" version="3.12.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.13.0" match="compatible"/>
<import plugin="org.eclipse.core.filesystem" version="1.7.0" match="compatible"/>
<import plugin="org.eclipse.text" version="3.6.0" match="compatible"/>
<import plugin="org.eclipse.osgi" version="3.7.0" match="compatible"/>
<import plugin="org.eclipse.equinox.common" version="3.8.0" match="compatible"/>
<import plugin="org.eclipse.core.jobs" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.equinox.registry" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.equinox.preferences" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.core.contenttype" version="3.3.0" match="compatible"/>
<import plugin="org.eclipse.equinox.app" version="1.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.equinox.common" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.equinox.registry" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.osgi" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.core.commands" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.equinox.common" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.2.0" match="compatible"/>
<import plugin="org.eclipse.swt" version="3.103.0" match="compatible"/>
<import plugin="org.eclipse.jface" version="3.13.0" match="compatible"/>
<import plugin="org.eclipse.ui.workbench" version="3.105.0" match="compatible"/>
<import plugin="org.eclipse.core.expressions" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.swt" version="3.104.0" match="compatible"/>
<import plugin="org.eclipse.core.commands" version="3.4.0" match="compatible"/>
<import plugin="org.eclipse.equinox.common" version="3.3.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.compare.core" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.expressions" version="3.4.100" match="compatible"/>
<import plugin="org.eclipse.jface.text" version="3.8.0" match="compatible"/>
<import plugin="org.eclipse.ui" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.runtime" version="3.11.0" match="compatible"/>
<import plugin="org.eclipse.core.filesystem" version="1.2.0" match="compatible"/>
<import plugin="org.eclipse.core.filebuffers" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.core.resources" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.text" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.ltk.core.refactoring" version="3.7.0" match="compatible"/>
<import plugin="org.eclipse.jface.text" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.ui.navigator" version="3.3.200" match="compatible"/>
<import plugin="org.eclipse.compare" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.team.core" version="3.4.100" match="compatible"/>
<import plugin="org.eclipse.team.ui" version="3.4.100" match="compatible"/>
<import plugin="org.eclipse.ui.editors"/>
<import plugin="org.eclipse.ui.views" version="3.8.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.jdt.ui" version="3.13.52" match="greaterOrEqual"/>
<import plugin="org.eclipse.jdt.core" version="3.13.50" match="greaterOrEqual"/>
</requires>
<plugin
id="org.eclipse.core.resources"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jdt.core"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.runtime"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.core.filesystem"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.text"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.equinox.common"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.jface"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ui.workbench.texteditor"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ltk.core.refactoring"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.eclipse.ltk.ui.refactoring"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="MetaCoder"
download-size="0"
install-size="0"
version="0.4.0"
unpack="false"/>
</feature>
未成功尝试在Eclipse JEE 2019-Jul中安装插件后,出现以下错误消息:
Cannot complete the install because of a conflicting dependency.
Software being installed: MyPlugin 0.4.0 (MyPluginFeature.feature.group 0.4.0)
Software currently installed: Eclipse Platform 4.13.0.v20190916-1323 (org.eclipse.platform.feature.group 4.13.0.v20190916-1323)
Only one of the following can be installed at once:
Core File Systems 1.7.500.v20190620-1312 (org.eclipse.core.filesystem 1.7.500.v20190620-1312)
Core File Systems 1.7.0.v20170406-1337 (org.eclipse.core.filesystem 1.7.0.v20170406-1337)
Core File Systems 1.7.400.v20190518-1151 (org.eclipse.core.filesystem 1.7.400.v20190518-1151)
Cannot satisfy dependency:
From: MyPlugin 0.4.0 (MetaCoderFeature.feature.group 0.4.0)
To: org.eclipse.equinox.p2.iu; org.eclipse.core.filesystem [1.7.0.v20170406-1337,1.7.0.v20170406-1337]
Cannot satisfy dependency:
From: Eclipse Platform 4.13.0.v20190916-1323 (org.eclipse.platform.feature.group 4.13.0.v20190916-1323)
To: org.eclipse.equinox.p2.iu; org.eclipse.core.filesystem [1.7.500.v20190620-1312,1.7.500.v20190620-1312]
在feature.xml
中,仅将您自己的插件指定为<plugin ... />
,而不是所需的(Eclipse)插件/捆绑包。
例如,
<plugin
id="org.eclipse.core.resources"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
使当前版本的插件/捆绑包org.eclipse.core.resources
(version="0.0.0"
是一个占位符,在构建更新站点时将被当前版本替换)是可以安装的东西的一部分。由于org.eclipse.core.resources
是单件插件/捆绑包(Bundle-SymbolicName: org.eclipse.core.resources; singleton:=true
),因此无法与其他版本的插件/捆绑包一起使用。这会阻止您的插件在许多Eclipse版本中进行部署。