更新後、古い Eclipse プラグインは「plugins」フォルダーに残ります (「features」フォルダーにも残りがあります)。
それらを自動的に削除する方法はありますか?
古いプラグインを削除するには、インストール履歴をクリアする必要があります。ヘルプに移動 | エクリプスについて | インストールの詳細 | インストール履歴とすべての古いものを選択します。次に、削除をクリックして再起動します。出来上がり。これは Eclipse Helios (3.6) で動作します。
古いプラグインも削除したいのですが、今日もまだ答えが見つからないので、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
生成されたremove-old-eclipse-plugins.txt
ファイルを使用してプラグインを削除する前に、リストされているすべてのプラグインが本当に古いプラグインであることを確認してください。このスクリプトは、ファイル名に複数の_
文字が含まれているため、処理できません。例: JUnit v3 と v4 プラグインは 2 つの異なるプラグインですが、これら 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
したがって、非常に慎重に使用し、間違った部分を削除してから使用してください。そうしないと、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]
...
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
古いプラグインの削除は常に面倒です。特に、アップグレードして Eclipse を再起動したくない場合は、プラグイン依存関係のメタデータ地獄を介して把握する必要があります。
スクリプトを使用してこれを修正しようとしている人を何人か見てきました。
さて、マニフェストファイル(またはマニフェストが不完全または破損している場合はファイル名)をイントロスペクトすることにより、プラグインの重複をチェックするJavaベースのツール(テスト付き、mavenによってビルドされ、githubでホストされているため、自由にフォークできます)を作成しました.
たとえば、最新の Eclipse をダウンロードして古い Eclipse をフォルダーに入れるdropins/eclipse
と、ツールが dropins フォルダーをクリーンアップすることが非常に簡単にできます。したがって、新しいバンドルは保持され、古いバンドルは削除されます (dropins
フォルダーが 2 つ以上同じである場合は、フォルダーを削除することをお勧めします)。バージョンが見つかります)。
Eclipse Plugin Cleanerの詳細については、https://github.com/azachar/eclipse-plugin-cleanerを参照してください。
並べ替えなどの代わりに、ソリューションは の内容に基づいている必要がありbundles.info
ます。
手動ソリューション:
eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
.*plugins/([^,]*),.*
、置換: $1
(例: Notepad++を使用)eclipse/plugin/
すべてのドロップイン、機能、およびプラグインを許可するようにスクリプトを変更しました。まず、最新の正規プラグイン バージョンを推測するために逆ソートに依存します。
次に、修飾されたプラグイン バージョン名を正規のプラグイン sed 式に減らします。プラグインがこの表現に最初に一致した場合、そのパターンを保存して保持します。それ以外の場合は古い古いバージョンであり、削除のフラグを立てます。
# scan_old_plugins.sh
# script to scan for duplicate old eclipse features, plugins and dropins
# generates a "clean-old-plugins.sh" script to clean old versions.
# warning: DANGEROUS! review clean-old-plugins script before running it.
DropinsDir=dropins
FeaturesDir=features
PluginsDir=plugins
CanonicalPluginsFile=sed_canonical_plugins.sh
CleanPluginScriptFile=clean_old_plugins.sh
echo "" > $CanonicalPluginsFile
echo "" > $CleanPluginScriptFile
#for dir in $PluginsDir
for dir in $FeaturesDir $PluginsDir $DropinsDir
do
echo "Processing [$dir] directory..."
#
file_list=$(\ls -1 $dir | sort -r);
echo "$file_list" > $dir-all.txt
#
for p in $(echo "$file_list")
do
v=$(echo $p | sed -e 's/_[0-9\._\-]*/_.*/g' | sed -e 's/[0-9][0-9]*/.*/g')
g=$(grep -l "$v" $CanonicalPluginsFile | head -1 | awk '{print $1}')
if [ "$g" = "" ]; then
echo "$p=keep";
echo "$v=$p" >> $CanonicalPluginsFile
else
echo "$p=stale";
echo "rm -rf $p" >> $CleanPluginScriptFile
fi
done
done
Ganymede (3.4) では、プラグインを管理する正しい方法は、プラグインを「dropins」フォルダーにドロップすることです。
\[eclipse\]/dropins/eclemma1.3.1/eclipse/(plugins|features)
そのプラグインは 'p2' プロビジョニング メカニズムによって検出され、使用されますが、Eclipse の plugins および features ディレクトリにはコピーされません。それは dropins フォルダーに残ります。
eclemma1.3.2 をドロップする場合、ドロップイン ディレクトリから eclemma1.3.1 を削除するだけで、古いバージョンはなくなります。
Eclipse では、以前の構成に戻すことができます ([ヘルプ] メニューから [ソフトウェアの更新] に移動します)。私の推測では、Eclipse はこれらの古いバージョンを削除しないか、この機能が機能しなくなるでしょう。
Eclipse を再起動するときに「-clean」引数を指定すると、さまざまなクリーンアップ操作が実行されますが、上記の理由により、古いプラグイン/機能が削除されるとは思いません。