小智 9
要删除旧插件,您必须清除安装历史记录.转到帮助| 关于Eclipse | 安装细节| 安装历史记录并选择所有旧的东西.然后单击删除并重新启动.瞧.这适用于Eclipse Helios(3.6)
我使用以下命令:
eclipse -application org.eclipse.equinox.p2.garbagecollector.application -profile epp.package.jee
Run Code Online (Sandbox Code Playgroud)
笔记:
这记录在Equinox/p2/FAQ 中,请参阅“当相关功能被删除时,为什么不删除包?”
常见问题解答引用了 Eclipse 社区论坛主题“功能卸载后插件 jar 仍然存在”(2010 年 6 月)作为本秘籍的来源。
该方法现在仍然有效,使用 Eclipse 4.8 Photon。
该-profile参数取决于您使用的 Eclipse IDE 的包装。上面的 ( epp.package.jee) 是针对“Eclipse for Java EE Developers”的。我在文件中找到了它configuration/config.ini。相关行如下:
eclipse.p2.profile=epp.package.jee
Run Code Online (Sandbox Code Playgroud)我也想删除旧的插件,但今天仍然没有找到答案,所以我写了一个快速而脏的脚本guess-old-eclipse-plugins.sh来处理旧的插件.
该脚本将扫描Eclipse目录下的plugins目录.并将生成一个remove-old-eclipse-plugins.txt可用于删除旧插件的文件.
此脚本在Windows XP上的Cygwin 1.7.15下进行了测试.
PluginsDir=plugins
FeaturesDir=features
PluginIDSeparator=_
RemovingScriptFileName=remove-old-eclipse-plugins.txt
rm -rf $RemovingScriptFileName
#for dir in $PluginsDir $FeaturesDir
for dir in $PluginsDir # $FeaturesDir: most file names in features dir contains more than 1 _ character
do
echo "Processing [$dir] directory..."
# split PluginID from filename
# (not reliable, but general working. (ex: will get one junit PluginID because there're move than 1 _ characters in file name))
file_list=$(ls $dir);
echo "$file_list" | cut -f1 -d $PluginIDSeparator > $dir-all.txt
echo "$file_list" | cut -f1 -d $PluginIDSeparator | uniq > $dir-uniq.txt
# get the PluginList which VERY POSSIBLY has old versions
diff_result=$(diff -U 0 $dir-uniq.txt $dir-all.txt)
plugins_which_has_old_versions=$(echo "$diff_result" | grep -e "^+[^+]" | cut -f 2 -d +)
#
for p in $(echo "$plugins_which_has_old_versions")
do
echo "$p"
i=0
for f in $(ls -d -t $dir/$p$PluginIDSeparator*) # use 'ls' command, can sort result by file time, but can not handle file name contains special characters (white space) when using wildcard
#for f in $(find $dir -name "$p$PluginIDSeparator*") # use 'find' command
do
if [ -d $f ]
then
# should use rm -rf
echo -n "[D]"
else
echo -n " "
fi
echo -n "$f"
((i++))
if [ $i -eq 1 ]
then
echo ""
continue # first file, the newest version
fi
echo " [old]"
echo "rm -rf $f" >> $RemovingScriptFileName
done
echo
done
done
Run Code Online (Sandbox Code Playgroud)
在使用生成的remove-old-eclipse-plugins.txt文件删除插件之前,请确保其中列出的所有插件都是真正的旧插件.因为,这个脚本无法处理的文件名包含多个1个_字符.例如:JUnit v3和v4插件是2个不同的插件,但脚本会将其视为相同的插件,因为这两个文件名使用相同的org.junit_前缀.
org.junit
[D]plugins/org.junit_3.8.2.v3_8_2_v20100427-1100
[D]plugins/org.junit_4.8.2.v4_8_2_v20110321-1705 [old] <-- wrong
Run Code Online (Sandbox Code Playgroud)
因此,非常小心地使用它,在使用它之前删除错误的部分,否则您的Eclipse IDE可能无法正常工作.
$ ./guess-old-eclipse-plugins.sh
Processing [plugins] directory...
org.eclipse.gef
plugins/org.eclipse.gef_3.7.2.v20111106-2020.jar
plugins/org.eclipse.gef_3.6.2.v20110110-2020.jar [old]
org.eclipse.help.base
plugins/org.eclipse.help.base_3.6.2.v201202080800.jar
plugins/org.eclipse.help.base_3.5.3.v201102101200.jar [old]
org.eclipse.help.ui
plugins/org.eclipse.help.ui_3.5.101.r37_20110819.jar
plugins/org.eclipse.help.ui_3.5.3.r36_20101116.jar [old]
...
Run Code Online (Sandbox Code Playgroud)
rm -rf plugins/org.eclipse.gef_3.6.2.v20110110-2020.jar
rm -rf plugins/org.eclipse.help.base_3.5.3.v201102101200.jar
rm -rf plugins/org.eclipse.help.ui_3.5.3.r36_20101116.jar
rm -rf plugins/org.eclipse.help.webapp_3.5.3.r36_20101130.jar
rm -rf plugins/org.eclipse.jdt.apt.core_3.3.402.R36_v20110120-1000.jar
rm -rf plugins/org.eclipse.jdt.debug.ui_3.5.2.v20100928a_r362.jar
Run Code Online (Sandbox Code Playgroud)
删除旧插件总是很麻烦.特别是当您升级并且您的Eclipse不想再次启动时,您需要通过插件依赖项的元数据来解决它.
我已经看到你们中的一些人试图通过脚本解决这个问题.
好吧,我已经创建了一个基于java的工具(带有测试,由maven构建并托管在github上,因此你可以自由分叉),通过内省清单文件(如果清单不完整或已损坏,则检查文件名)来检查插件的重复性.
您可以非常轻松地下载最新的Eclipse并将旧的Eclipse放入dropins/eclipse文件夹,该工具将清理dropins文件夹 - 因此您的新捆绑包将被保留,旧的捆绑包将被删除(dropins如果2个或更多文件夹,则优先删除该文件夹找到版本).
有关Eclipse插件清理程序的更多信息,请访问https://github.com/azachar/eclipse-plugin-cleaner
而不是排序等,解决方案应该基于bundles.info.
手动解决:
eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info.*plugins/([^,]*),.*,替换为:($1例如使用Notepad++)eclipse/plugin/Eclipse 允许您恢复到任何以前的配置(转到“帮助”菜单,然后“软件更新”)。我的猜测是 Eclipse 不会删除这些旧版本,否则此功能将不再起作用。
如果您重新启动 Eclipse 时提供“-clean”参数,它会执行各种清理操作,但由于上述原因,我认为它不会删除旧的插件/功能。
| 归档时间: |
|
| 查看次数: |
17799 次 |
| 最近记录: |