之前用的svn,挺好用的,但是换了myeclipse 10,傻了,竟然木有svn。最要命的是用myeclipse 10没法添加插件,死麻烦,死麻烦的。抽了一下午时间,终于找到了最终的解决方案。
其实安装http://subclipse.tigris.org/,插件还是挺好安装的。但是这svn,用起来,还不是很爽啊。毕竟是用惯了cvs的,所以还是喜欢那样的风格。于是乎,在eclipse网站,终于淘到了subversive。决定动手装一个。
如何手动安装myeclipse 插件。
在网上,可以到处可见,就是使用如下的程序,生成插件信息,填写到配置文件中。这里贴出源代码
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* MyEclipse10 插件配置代码生成器
*/
public class PluginConfigCreator {
public PluginConfigCreator() {
}
public void print(String path) {
List list = getFileList(path);
if (list == null) {
return;
}
int length = list.size();
for (int i = 0; i < length; i++) {
String result = "";
String thePath = getFormatPath(getString(list.get(i)));
File file = new File(thePath);
if (file.isDirectory()) {
String fileName = file.getName();
if (fileName.indexOf("_") < 0) {
print(thePath);
continue;
}
String[] filenames = fileName.split("_");
String filename1 = filenames[0];
String filename2 = filenames[1];
result = filename1 + "," + filename2 + ",file:/" + path + "/"
+ fileName + "\\,4,false";
System.out.println(result);
} else if (file.isFile()) {
String fileName = file.getName();
if (fileName.indexOf("_") < 0) {
continue;
}
int last = fileName.lastIndexOf("_");// 最后一个下划线的位置
String filename1 = fileName.substring(0, last);
String filename2 = fileName.substring(last + 1,
fileName.length() - 4);
result = filename1 + "," + filename2 + ",file:/" + path + "/"
+ fileName + ",4,false";
System.out.println(result);
}
}
}
public List getFileList(String path) {
path = getFormatPath(path);
path = path + "/";
File filePath = new File(path);
if (!filePath.isDirectory()) {
return null;
}
String[] filelist = filePath.list();
List filelistFilter = new ArrayList();
for (int i = 0; i < filelist.length; i++) {
String tempfilename = getFormatPath(path + filelist[i]);
filelistFilter.add(tempfilename);
}
return filelistFilter;
}
public String getString(Object object) {
if (object == null) {
return "";
}
return String.valueOf(object);
}
public String getFormatPath(String path) {
path = path.replaceAll("\\\\", "/");
path = path.replaceAll("//", "/");
return path;
}
public static void main(String[] args) {
/* 你的SVN的features 和 plugins复制后放的目录 */
String plugin = "D:\\ProgramFiles\\Local\\MyEclipse\\MyEclipse 10\\svn";
new PluginConfigCreator().print(plugin);
}
}
“String plugin = "D:\\ProgramFiles\\Local\\MyEclipse\\MyEclipse 10\\svn";”就是你的svn插件的存放地址了。注意要用\\
运行后,会生成相关的配置信息,然后把他填写到,如下文件的末尾
D:\ProgramFiles\Local\MyEclipse\MyEclipse 10\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info
好了,如何配置安装插件已经学会了,接下来看看如何获取正统的svn插件。就是到如下网址下载
www.eclipse.org/subversive/downloads.php
对应我用的zip文件是
http://community.polarion.com/projects/subversive/download/eclipse/2.0/builds/Subversive-connectors-2.2.2.I20100512-1900.zip
http://www.eclipse.org/downloads/download.php?file=/technology/subversive/0.7/builds/Subversive-incubation-0.7.9.I20100512-1900.zip
用的版本有点老的啊,和ie6,xp一样经典。
至于版本,版本号等等是不是要统一,我没有过多的尝试。老规矩,寻择了统一的版本。
解压到svn文件夹下,生成配置文件信息,填写到配置文件。重启myeclipse,不出意外就会看到svn了。
。。。。。。。。。。。。。。
或者直接把
features
plugins
复制到
目录MyEclipse\MyEclipse 10\dropins下,重启
以下是参考网址:
http://www.eclipse.org/subversive/downloads.php
http://www.polarion.com/products/svn/subversive/download.php
http://community.polarion.com/projects/subversive/download/eclipse/2.0/builds/
这个月算是开篇了,意味着又要从php转战java了。