在 ECLIPSE_HOME/plugins 以外的目录中安装 Eclipse (3.4+) 插件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/582391/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing Eclipse (3.4+) plugins in a directory other than ECLIPSE_HOME/plugins
提问by Binil Thomas
There used to be a way to do this, but I can no longer find this in Eclipse 3.4.1 installation I have. Does anyone know how to do this?
曾经有一种方法可以做到这一点,但我在 Eclipse 3.4.1 安装中再也找不到它了。有谁知道如何做到这一点?
回答by VonC
Update May 2014, Eclipse 4.x
2014 年 5 月更新,Eclipse 4.x
As oberlieskindly points out in the comments:
Dropins are deprecated! Don't use them!
Dropins 已弃用!不要使用它们!
Even though they are still documented (in Kepler 4.3 for instance), this threadadds:
即使它们仍然被记录在案(例如在开普勒 4.3 中),这个线程补充说:
One of the reasons that Eclipse does not recommend the dropins folder method of installation is that there is no feedback if something goes wrong. Any number of things could be getting in the way.
- If you were using the install UI, you'd be informed of the problems before any changes are made.
- With dropins, Eclipse tries to install and start as much as it can and you don't really know what's going on.
Eclipse 不推荐使用 dropins 文件夹安装方法的原因之一是如果出现问题没有反馈。任何数量的事情都可能成为障碍。
- 如果您使用的是安装 UI,则会在进行任何更改之前通知您存在的问题。
- 使用 dropins,Eclipse 会尝试尽可能多地安装和启动,而您并不真正知道发生了什么。
A Local deployment, as shown in this tutorial, would rather use File → Export → Plug-in Development → Deployable plug-ins and fragments
.
本地部署,如本教程所示,宁愿使用File → Export → Plug-in Development → Deployable plug-ins and fragments
.
But the final destination remains in ECLIPSE_HOME/plugins
.
但最终目的地仍然在ECLIPSE_HOME/plugins
.
Original answer (2009, Eclipse 3.x)
原始答案(2009,Eclipse 3.x)
You should add your plugins in ECLIPSE_HOME/dropins
.
您应该将插件添加到ECLIPSE_HOME/dropins
.
If you want to defined common plugins, use bundle pools(also introduced here)
如果你想定义通用插件,使用bundle pools(这里也有介绍)
You can also use an own extra dropins folder: simply add a parameter into eclipse.ini
:
您还可以使用自己的额外 dropins 文件夹:只需将参数添加到eclipse.ini
:
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory= /your_path/e34shared_dropin
This extra dropins location can be used from more then one Eclipse installations - so you can use it as a shared dropins (watched directory).
这个额外的 dropins 位置可以从多个 Eclipse 安装中使用 - 因此您可以将其用作共享 dropins(监视目录)。
For Bundle Pool, you have here a step by step procedure:
对于Bundle Pool,这里有一个分步程序:
To better address your issue, you might find interesting the following article:
为了更好地解决您的问题,您可能会发现以下文章很有趣:
p2: how I install plugins in extension locations(from the Eclipse and Java Blog by Michael Scharfblog)
p2:我如何在扩展位置安装插件(来自Michael Scharf博客的Eclipse 和 Java博客)
The following procedure explains how to install plugins into different extension locations and share those extension locationsbetween different eclipse installations using the p2 update manager and link files. For a lengthly discussion see bug 224145
以下过程解释了如何将插件安装到不同的扩展位置并使用p2 更新管理器和链接文件在不同的 eclipse 安装之间共享这些扩展位置。有关详细讨论,请参阅错误 224145
(Note: p2 is the "new" way to manage plugins, links is the "old" way to reference plugins outside the eclipse installation directory)
(注意:p2是管理插件的“新”方式,links是在eclipse安装目录外引用插件的“旧”方式)
I keep a set of different extensions locations in
C:\eclipse\extensions
(each extension location is in a subdirectory of that directory).
Suppose I want to install foo into the new extension locationC:\eclipse\extensions\foo
.
- I start eclipse with:
我保留了一组不同的扩展位置
C:\eclipse\extensions
(每个扩展位置都在该目录的子目录中)。
假设我想将 foo 安装到新的扩展位置C:\eclipse\extensions\foo
。
- 我开始日食:
-configuration C:\eclipse\extensions\foo\eclipse\configuration
I install foo using the update manager.
Now I can use the extension by creating a
foo.link
file inside the links directory of an eclipse installation (you might have to create the[eclipse]\links
directory) containing:
我使用更新管理器安装 foo。
现在我可以通过在
foo.link
eclipse 安装的 links 目录中创建一个文件来使用扩展(您可能必须创建[eclipse]\links
目录),其中包含:
path=C:/eclipse/extensions/foobar
That's it :-)
Notes:
- You have to the forward slashes on windows in the links file.
- This procedure works for eclipse 3.4 and 3.5.
- You don't have to create any directory specified by the -configuration parameter. Eclipse will do that for you.
- It is important to follow the pattern
EXTENSION_NAME/eclipse/configuration
for the "-configuration
" parameter because p2 will put the plugins one directory above the configuration directory and link files require that the directory that contains the plugins is called eclipse.- With this structure I can update plugins into the extension locations by running eclipse with the -configuration and then do the update.
Advanced use: If I want to install bar based on my foo extension, I create a link file to foo in the bar extension location links directory:
就是这样 :-)
笔记:
- 您必须在链接文件中的窗口上使用正斜杠。
- 此过程适用于 Eclipse 3.4 和 3.5。
- 您不必创建由 -configuration 参数指定的任何目录。Eclipse 会为您做到这一点。
- 遵循
EXTENSION_NAME/eclipse/configuration
"-configuration
" 参数的模式很重要,因为 p2 会将插件放在配置目录上方一个目录,并且链接文件要求包含插件的目录称为 eclipse。- 使用这种结构,我可以通过使用 -configuration 运行 eclipse 将插件更新到扩展位置,然后进行更新。
高级使用:如果我想根据我的 foo 扩展安装 bar,我在 bar 扩展位置链接目录中创建一个到 foo 的链接文件:
C:\eclipse\extensions\bar\eclipse\configuration\links\foo.link
and follow my standard procedure described above (the links directory can be populated before the first run of eclipse)...
Note for eclipse 3.4: If you are using eclipse 3.4 and you want to use the eclipse default update sites, you have to run eclipse without "
-configuration
" and export them (Help->Software Updates->Available Software (tab)->Manage Sites->Export
), so you can import them into the "-configuration
" eclipse.
并遵循我上面描述的标准程序(可以在第一次运行 eclipse 之前填充链接目录)...
eclipse 3.4 的注意事项:如果您使用的是 eclipse 3.4 并且想要使用 eclipse 默认更新站点,则必须在没有“
-configuration
”的情况下运行 eclipse并导出它们 (Help->Software Updates->Available Software (tab)->Manage Sites->Export
),以便您可以将它们导入到“-configuration
” eclipse 中。
回答by Uri
Not sure if this is what you are seeking, but if you manually obtain plugins (not via the loader, just as jars), you can use the dropins mechanism.
不确定这是否是您要寻找的,但如果您手动获取插件(不是通过加载程序,就像 jars),您可以使用 dropins 机制。
Go to ECLIPSE_HOME/dropins
去 ECLIPSE_HOME/dropins
Create a directory named "SomeNameForFunctionality" Create a subdirectory named "eclipse" underneath Create subdirectories named "features" and "plugins" underneath "Eclipse" Move the plugins and feature jars to the corresponding subdirectories.
创建一个名为“SomeNameForFunctionality”的目录 在下面创建一个名为“eclipse”的子目录 在“Eclipse”下面创建一个名为“features”和“plugins”的子目录 将插件和功能jar 移动到相应的子目录中。
Restart Eclipse and make sure it takes a few more seconds to load. Your plugin should still be there.
重新启动 Eclipse 并确保加载需要几秒钟的时间。你的插件应该还在那里。
回答by zvikico
The Dropins folder is a good solution if you install plugins manually. If you are installing plugins through the update manager, you cannot select the install location for your plugins through the UI. Not anymore.
如果您手动安装插件,Dropins 文件夹是一个很好的解决方案。如果您通过更新管理器安装插件,则无法通过 UI 选择插件的安装位置。不再。
BTW, if you like sharing plugins among several Eclipse installations, you can create a Link file, drop it in the Dropins folder and it works just the same, no need to modify the INI.
顺便说一句,如果您喜欢在多个 Eclipse 安装之间共享插件,您可以创建一个链接文件,将其放在 Dropins 文件夹中,它的工作原理是一样的,无需修改 INI。
A Link file is a plain text file, which ends with .link extension, and has one line in it: path=/path/to/your/plugins
链接文件是一个纯文本文件,以 .link 扩展名结尾,其中有一行: path=/path/to/your/plugins
回答by Adam
I just wasted an hour trying to deploy a plugin in the dropins/ directory in eclipse 3.7 and thought I'd share.
我只是浪费了一个小时试图在 eclipse 3.7 的 dropins/ 目录中部署一个插件,并认为我会分享。
It turns out the preview files generated by MacOS X (starting ._ e.g. .com.example.myplugin.jar) were interfering with the P2 auto-detection and causing it to fail before it reached my plugin. I did a search for all .files and deleted them and the plugin was finally loaded
事实证明,MacOS X 生成的预览文件(以 ._ 开头,例如.com.example.myplugin.jar)干扰了 P2 自动检测并导致它在到达我的插件之前失败。我做了所有的搜索。文件并删除它们,插件终于加载了