異なるバージョンのEclipseをマージ


従来はEclipse IDE for Java and DSL Developersバージョンで、J 2 EEの一部を統合していない.公式にはJ 2 EE向けのもう一つのバージョン、Eclipse IDE for J 2 EE Developersが提供されています.サーバーなどのWebを利用するにはJ 2 EEのバージョンを使うか、有名だが有料のMyEclipseプラグインなどJ 2 EEのプラグインを自分でインストールする必要があります.MyEclipseプラグインは強力で、機能はそろっていますが、起動速度が遅い(パソコンのハードウェアが低いという問題もあるかもしれません)ので、MyEclipseはあまり使いたくありません.他のオープンソースJ 2 EEプラグインを探して、多くは直接Eclipse IDEにバインドして完全版でダウンロードを提供しています.私がずっと使っていたEclipse IDE for Java and DSL Developersバージョンを使い続けたいのですが、またEclipse IDE for J 2 EE Developersバージョンの機能を使いたいので、この2つのバージョンを直接統合してもらえないかと思います!カーネルとプラグインのモードのEclipseに基づいて理論の上で通じるべきで、ネット上で多くの資料(この方面の資料は少ない)を調べて、最後にこのホームページが比較的にそろっていることを見て、その上方法の試験の後で証明するのは正しいで、今私のEclipseは2つのEclipseのインストールパッケージを集積して、妥当です!
テキストリンク:http://stackoverflow.com/questions/6251063/how-to-combine-all-the-packages-of-the-eclipse
原文内容:
How to merge several setup packages of Eclipse?
複数のEclipseインストールパッケージをマージする方法
Whom this is for?
The ones that can not hold back their temper any longer when trying to install another Eclipse function package. Right the installation speed from some countries is too slow to bear, also the Equinox P2 always try to connect the Download.Eclipse.org. Much to damn.. when your Internet connection closed or reset all of a sudden and got all downloaded files broken. Also OSGi based Eclipse plugins is chaos -- always have some conflict errors.
Oh that is another problem..
この文書は、既存のEclipseに他のEclipseパッケージをインストールしようとしているが、一部の国のEclipse更新体験に狂っている人に捧げます.
Do the following steps:
方法は、次のステップです.
1 Download the Install Packages that you need from www.eclipse.org. Also please remember verify to see if that is correct package. I choosed J2EE with C/C++.
まず、Eclipseのダウンロード公式サイトからインストールしたいインストールパッケージをダウンロードし、パッケージが完全であるかどうかを確認してください.ここではJ 2 EEとC/C++を選びました.
2 Unpack one package with uncompress softwares, such as 7-zip and WinRAR. unzip all the files to a directory you wanna install to. for example "D:\Eclipse\".
7-zipやWinRARなどの圧縮ソフトウェアを使用して、インストールする場所に解凍します.
3 open Configurations. Files "\configuration\org.eclipse.equinox.source\source.info"and "\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info"in the installation directory is the ones that need to be merged. also you need "\configuration\org.eclipse.update\platform.xml".
すべてのインストールパッケージのファイルを開き、すべてのインストールパッケージから「configurationorg.eclipse.equinox.sourcesource.info」、「configurationorg.eclipse.equinox.simpleconfiguratorbundles.info」、「configurationorg.eclipse.updateplatform.xml」の3つのファイルを探します.
4 open the other packages and fetch their configuration files, and merge files.
これらのファイルをどこかにコピーしてマージを開始します.
to Bundles.info:
Open the bundle.info with any Functional Text Editor, copy all text begin from the line after "#version={Number}"and paste it to another. [{Number} means any Integer number.]
Bundles.infoファイル:
少し高度なエディタ[Wordなんて使わないで]を使って、「#version={Number}」の次の行から始まるすべてのテキストをいずれかにコピーします[いずれかは、あなたが最後の結果を出すファイルの1つです].ここで{Number}はどんな数字を言っていますか.
to Source.info:
Similiar with what you did with the bundle.info. If not modified, that line should be the 3rd line in the text file.
Source.infoファイル:
次の方法はそれほど悪くない.修正されていなければ、3行目から始まるはずです.
to Platform.xml:
Open the file, then find where ""node. Find the ""tag and copy all the text between them, paste to another file just before the ""tag.
[You can do the similiar also marked tags with artifacts.xml]
Platform.xmlファイル:
開いて、を探します.ラベルの後の最初のまで、すべてコピーして、別の中に貼ります.
処理が必要ならxmlも、このような方法です.
5 when merging i suggest you to make a new directory and when finished please remember copy the merged file to the one where should it be and overwrite. [I mean where it comes from]
Although not merge "platform.xml"will not cause any functional errors, it will make the About dialog with no button -- to ugly yeah?
[= =|||]Ugly is caused by the artifacts.xml in the installation directory...
マージを行うときは、フォルダを用意して大量のファイルを保存し、マージが完了してから合成の結果を元の場所に上書きすることをお勧めします.
だがxmlをマージしなくても機能的な問題はありませんが、Aboutフォームが醜くなる可能性があります.
[囧]実はインストールディレクトリの下のartifactsであることを発見した.xmlによるこの問題.
6 Open all the package, find "plugins"and "features"directories.now extract!
first extract the one you want most. I extracted JEE package.
then extract the other ones. I don't see any problem whether Overwrite the ones or not.
すべてのインストールパッケージを開き、中のpluginsとfeaturesディレクトリを見つけ、すべてインストール場所の対応する場所に解凍します.
例えば、J 2 EEのパッケージを解凍してから、他のパッケージにします.
実は、もしあなたがダウンロードしたのがすべて同じ时に出たならば、例えば、すべて3.6 M 2で、それではカバーしないであなたの気持ちを見てみましょう.
7 do open a console window, and locale in the installation directory, and then execute "eclipse.exe".
最後にコマンドラインを開き、インストールディレクトリにeclipseを入力.exeはその後実行されます.
Well, somebody ask me why i paid no attention to the Artifacts.xml in the installation directory. That's because Eclipse will never check the file. It seems to be when you want to update using zip files -- however this way is blocked for lacking site.xml file now.
なぜインストールディレクトリの下にあるartifactsを無視したのかと聞かれましたxml……このファイルEclipseはまったく関係ありません……実は私がそのファイルを削除したとしても、開くべきIDEはそのままにしておいて間違いない……本来は以前のバージョンのためにインストールパッケージを使って更新していたのですが、現在のプラットフォームのEquinox更新によりsite.xmlが欠けています.結局、この方法は使えません.
Then guys, wait a several minutes for eclipse to do some sorting and cleaning job for the merged configurations.. and install your plugins!
はい、この時間が終わったばかりでずいぶん時間がかかったのを覚えています.最初のEclipseが開くのを見るには数分待たなければなりません.Eclipseは私たちが以前合併した設定ファイルを処理しなければならないからです.彼が開けたら、プラグインをインストールしてください.
INFO: if you face some problems after install a new plugin and restart.. that is because you haven't finish a complete artifacts.xml merging.
You may delete all the artifacts.xml 's header [document start to the ] and its bottom [from to document end]. just merge the left content. and make one file just contains the header and bottom, paste the merged one in.
Eh..maybe you can calculate the {Number}s' sum and correct the one in the final document.
——————————————————————————
まとめ方:主に4つのパラメータファイル:Bundles.info、Source.info、Platform.xml、artifacts.xmlは、異なるインストールパッケージバージョンのこの4つのファイルを、最後に最後にバージョンをマージしたパラメータファイルにマージします.その中でBundles.info、Source.infoの2つのファイルの同じバージョン番号の異なるインストールパッケージには同じパラメータが含まれており、直接統合しても大きな問題はありませんが、コードの潔癖さがあります.したがって、いくつかの行のコードを作成してマージします(原理は動作単位でフィルタを比較します).ソースコードは次のとおりです.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.Vector;
 
public class CleanFiles {

	private static Vector<String> stringlist;

	public static void main(String[] args) throws Exception {
		String filePath1;
		String filePath2;
		String filePath3;
		String item;
		stringlist = new Vector<String>();
		BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
		System.out.println("     1      :");
		filePath1 = buffer.readLine();
		System.out.println("     2      :");
		filePath2 = buffer.readLine();
		System.out.println("              ");
		filePath3 = buffer.readLine();
		File file1 = new File(filePath1);
		File file2 = new File(filePath2);
		File file3 = new File(filePath3);
		buffer.close();
		buffer = new BufferedReader(new FileReader(file1));
		while((item=buffer.readLine())!=null){
			 addString(stringlist,item);
		}
		buffer.close();
		buffer = new BufferedReader(new FileReader(file2));
		while((item= buffer.readLine())!=null){
			addString(stringlist,item);
		}
		buffer.close();
	 
		//           ,           File
		for (int i = 0; i < stringlist.size()-1; i++) {
			if(stringlist.get(i).equals(stringlist.get(i+1))){
				stringlist.remove(i);
				if(i!=0)i--;
			}
		}
	   
		BufferedWriter bufferWriter = new BufferedWriter(new FileWriter(file3));
			for(String temp:stringlist){
				bufferWriter.write(temp);
				bufferWriter.newLine();
			}
			bufferWriter.close();
		}
	
		public static void addString(Vector<String> allStrings, String str) {
		if (allStrings.isEmpty()) {
			allStrings.add(str);
		} else {
		
			//      
			int left = 0, right = allStrings.size() - 1, middle, compare;
			if (str.compareToIgnoreCase(allStrings.get(right)) >= 0) {
				allStrings.add(str);
				return;
			}
			if (str.compareToIgnoreCase(allStrings.get(0)) <= 0) {
				allStrings.add(0, str);
				return;
			}
			while (true) {
				middle = (left + right) / 2;
				compare = str.compareToIgnoreCase(allStrings.get(middle));
				if (compare == 0 || middle == left) {
					allStrings.add(middle + 1, str);
					return;
				} else {
					if (compare < 0) {
						right = middle;
					} else {
						left = middle;
					}
				}
			}
		}
	}
}

Platform.xmlファイルのマージ後も、重複するノードが多く、別のコードを書いて処理します(もちろん処理しなくても大丈夫ですが)、原理は各行のノードの順序をマークしてフィルタリングし、最後に元の順序で並べ替えて、同じように直接コードをここに貼り付けます(備考:私はこのコードで処理する時、どうして最後に2番目のが削除されるのか分かりません.研究は長い間考えていませんでしたが、遅くても遅くてもやっていません.自分で手で加えました):
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.Vector;

public class CleanXMLFiles {

        private static Vector<XMLElement> xmllist;

        public static void main(String[] args) throws Exception {
                String filePath1;
                String filePath2;
                String element;
                String item;
                xmllist = new Vector<XMLElement>();
                BufferedReader buffer = new BufferedReader(new InputStreamReader(
                                System.in));
                System.out.println("   xml        :");
                filePath1 = buffer.readLine();
                System.out.println("              ");
                filePath2 = buffer.readLine();
                System.out.println("          :");
                element = buffer.readLine();
                File file1 = new File(filePath1);
                File file2 = new File(filePath2);
                buffer.close();
                buffer = new BufferedReader(new FileReader(file1));
                int fileId = 0;
                while ((item = buffer.readLine()) != null) {
                        StringBuffer stringBuffer = new StringBuffer();
                        stringBuffer.append(item);
                        if (item.trim().startsWith("<" + element)) {
                                do {
                                        if((item = buffer.readLine())!=null){
                                                stringBuffer.append(item);
                                        }
                                } while (!(item.trim().endsWith("</" + element + ">")));

                        }
                        addString(xmllist,new XMLElement(fileId++,stringBuffer.toString()));
                }
                buffer.close();

                //           ,           File
                for (int i = 0; i < xmllist.size() - 1; i++) {
                        if (xmllist.get(i).getElementString().trim().equals(xmllist.get(i + 1).getElementString().trim())) {
                                xmllist.remove(i);
                        }
                }
                
                XMLElement big;
                for(int i=0;i<xmllist.size();i++){
                        for(int j=i+1;j<xmllist.size();j++){
                                if(xmllist.get(i).getId()>xmllist.get(j).getId()){
                                        big = xmllist.get(i);
                                        xmllist.set(i, xmllist.get(j));
                                        xmllist.set(j, big);
                                }
                        }
                }
                

                BufferedWriter bufferWriter = new BufferedWriter(new FileWriter(file2));
                for (XMLElement temp : xmllist) {
                        bufferWriter.write(temp.getElementString());
                        bufferWriter.newLine();
                }
                bufferWriter.close();

        }

        public static void addString(Vector<XMLElement> allStrings,
                        XMLElement elementTemp) {
                if (allStrings.isEmpty()) {
                        allStrings.add(elementTemp);
                } else {

                        //      
                        int left = 0, right = allStrings.size() - 1, middle, compare;
                        if (elementTemp.getElementString().compareToIgnoreCase(
                                        allStrings.get(right).getElementString()) >= 0) {
                                allStrings.add(elementTemp);
                                return;
                        }
                        if (elementTemp.getElementString().compareToIgnoreCase(
                                        allStrings.get(0).getElementString()) <= 0) {
                                allStrings.add(0, elementTemp);
                                return;
                        }
                        while (true) {
                                middle = (left + right) / 2;
                                compare = elementTemp.getElementString().compareToIgnoreCase(
                                                allStrings.get(middle).getElementString());
                                if (compare == 0 || middle == left) {
                                        allStrings.add(middle + 1, elementTemp);
                                        return;
                                } else {
                                        if (compare < 0) {
                                                right = middle;
                                        } else {
                                                left = middle;
                                        }
                                }
                        }
                }
        }
}

class XMLElement {
        private int id;
        private String elementString;

        public XMLElement(int id, String elementString) {
                super();
                this.id = id;
                this.elementString = elementString;
        }

        public int getId() {
                return id;
        }

        public void setId(int id) {
                this.id = id;
        }

        public String getElementString() {
                return elementString;
        }

        public void setElementString(String elementString) {
                this.elementString = elementString;
        }
}

artifacts.xmlファイルについては、私が調べたとき、重複するノードはあまりなく、処理されていなかったようです.
以上の振り回すのは個人の手が安いので、必要な人の参考に供します.