MyEclipse7.5下如何安装SpringIDE插件

来源:互联网 发布:wifi网络破解器 编辑:程序博客网 时间:2024/06/05 00:51

      今天download了MyEclipse7.5(Eclipse版本3.4)。由于要开发Spring程序,因此准备下载SpringIDE插件帮助开发。

MyEclipse7.5自带了SpringIDE,为了建立Spring工程,按照步骤文件->新建->其他,选择MyEclipse文件夹下Spring子

文件夹,发现其中只有两项,没有Spring Project选项(晕!MyEclipse太弱了,真想放弃了)

    

      虽然可以通过在工程上点击鼠标右键-》MyEclipse-》add Spring Capabilities解决,可还是感觉不爽,因此决定下载

SpringIDE2.2.1插件自行安装。

 

      在菜单栏点击帮助->software updates->add/remove software进入在线更新。在弹出的对话框中选择Personal

Software 点击Add按钮,弹出新对话框。点击add site 按钮,弹出对话框,输入spring ide在线更新网址:

http://dist.springframework.org/release/IDE (Name由个人喜好,我写的是Spring IDE),点击确定按钮,在

Personal Software下会出现Spring IDE子项目(和上面写的Name同名)展开树中Spring IDE项目,并选择要安装的插件,

点击Next按钮,然后点击Apply按钮等待更新。

 

结果在更新过程中出错 ,  错误信息如下:

Cannot complete the install because some dependencies are not satisfiable
  Cannot find a solution where both Match[[com.genuitec.myeclipse.enterprise.workbench.feature.group 7.5.0.zmyeclipse75020090612] requiredCapability: org.eclipse.equinox.p2.iu/org.springframework.ide.eclipse.aop.ui.matcher/[2.2.0.zmyeclipse75020090612,2.2.0.zmyeclipse75020090612]] and Match[[org.springframework.ide.eclipse.aop.feature.feature.group 2.2.6.200908051215-RELEASE] requiredCapability: org.eclipse.equinox.p2.iu/org.springframework.ide.eclipse.aop.ui.matcher/[2.2.6.200908051215-RELEASE,2.2.6.200908051215-RELEASE]] can be satisfied.
  Cannot find a solution where both Match[[org.springframework.ide.eclipse.feature.feature.group 2.2.6.200908051215-RELEASE] requiredCapability: org.eclipse.equinox.p2.iu/org.springframework.ide.eclipse.beans.ui/[2.2.6.200908051215-RELEASE,2.2.6.200908051215-RELEASE]] and Match[[com.genuitec.myeclipse.enterprise.workbench.feature.group 7.5.0.zmyeclipse75020090612] requiredCapability: org.eclipse.equinox.p2.iu/org.springframework.ide.eclipse.beans.ui/[2.2.0.zmyeclipse75020090612,2.2.0.zmyeclipse75020090612]] can be satisfied.
   ……… ……… ……… ………

   ……… ………(错误太长,其它省略了)
 

      分析这些错误,大概是说springide中的插件与myeclipse中的插件冲突。google一下,发现是myeclipse的问题。网上有人说是Myeclipse7.0以后对集成在其中的某些插件做了修改,这样使用者只能使用Myeclipse给出的版本而无法进行更新。据某些人士透漏MyEclipse说在7.5以后会改变这个策略——可至今不见动作,等待8.0吧。

     错误出了就得解决,不让在线更新我就自己下插件手动解决。首先在Spring IDE(http://springide.org/blog/2008/09/30/spring-ide-22-released/)下载Spring IDE2.2.1插件包,然后将其解压并拷贝(解压后文件夹命名为spring-ide)到%MYECLIPSE_HOME%/MyEclipse 7.5/下(%MYECLIPSE_HOME%为MyEclipse安装目录)。

    MyEclipse7.0以后不再使用link作为插件安装方式,而是采用如下方式:

    1. 打开MyEclipse IDE ,新建Java工程,并创建类CreatePluginsConfig,将以下代码拷贝到CreatePluginsConfig.java文件。

 

import java.io.File;
import java.util.ArrayList;
import java.util.List;


/**
 *     MyEclipse 7.5 (2009-6-17) 插件代码生成工具   

 * 生成的代码放入 /configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
 * 然后在命令提示符中使用 myeclipse.exe -clean 重启 或者关闭MyEclipse在打开即可使用中文版
 *
 */
public class CreatePluginsConfig {

 public CreatePluginsConfig() {
 }

 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) {
  // 插件文件所在目录designer下的目录结构是eclipse/features and plugins的形式
  String plugin ="H://Program Files//Genuitec//MyEclipse 7.5//spring-ide";
  new CreatePluginsConfig().print(plugin);
 }
}
    其中红色部分要改成你自己的相应目录

 

    2. 执行程序并拷贝控制台输出,将其追加到%MYECLIPSE_HOME%/MyEclipse 7.5//configuration/org.eclipse.equinox.simpleconfigurator/bundles.info文件末尾保存并关闭MyEclipse。

 

    3.进入%MYECLIPSE_HOME%/MyEclipse 7.5//Comon/plugins 中将org.springframework.ide.*删除

(或剪切到其它文件夹以防以后使用)。

 

    4 启动MyEclipse。好了,Spring工程出现了,而且不是在MyEclipse文件夹下而是与MyEclipse平行。

 

 

 

  综上,解决方法主要是将MyEclipse中产生冲突的插件删除并加入需要版本的插件就可以了。其他插件也可用类似方法解决。

   

原创粉丝点击