eclipse插件 本地镜像安装

Eclipse用久了,难免来点头疼脑热,这时重重装升升级,都是难免的。

然而,这是一件非常痛苦的事情:

1. 你还记得每一个插件的名字吗?
2. 你要去找它们的update site
3. 国外网速慢,等死人

折腾下来,一两个小时都没了。

那么,有没有办法让我们只下载一次呢?

有!而且很简单!

利用eclispe提供的p2.mirror任务即可。具体做法如下:

1. 在eclipse中定义一个java项目,名称任意
2. 在根目录下创建一个build.xml文件
3. 内容如下:

<?xml version="1.0" encoding="UTF-8"?>

<project name="project" default="download_eclipse_plugins">

  <target name="download_eclipse_plugins">

    <property name="maven-1.0.dir" value="C:\eclipse_plugins_repo\maven-1.0" />
    <p2.mirror destination="file:/${maven-1.0.dir}" description="maven-1.0" verbose="true">
      <source>
        <repository name="maven-1.0" location="http://download.eclipse.org/technology/m2e/releases/1.0/1.0.0.20110607-2117/" />
      </source>
      <slicingOptions includeFeatures="true" followStrict="true" latestVersionOnly="true" />
    </p2.mirror>

    <property name="mylyn-3.3.dir" value="C:\eclipse_plugins_repo\mylyn-3.3" />
    <p2.mirror destination="file:/${mylyn-3.3.dir}" description="mylyn-3.3" verbose="true">
      <source>
        <repository name="mylyn-3.3" location="http://archive.eclipse.org/mylyn/drops/3.2.2/v20090912-0400/e3.3" />
      </source>
      <slicingOptions includeFeatures="true" followStrict="true" latestVersionOnly="true" />
    </p2.mirror>

    <property name="svnkit-1.4.dir" value="C:\eclipse_plugins_repo\svnkit-1.4" />
    <p2.mirror destination="file:/${svnkit-1.4.dir}" description="svnkit-1.4" verbose="true">
      <source>
        <repository name="svnkit-1.4" location="http://subclipse.tigris.org/update_1.4.x" />
      </source>
      <slicingOptions includeFeatures="true" followStrict="true" latestVersionOnly="true" />
    </p2.mirror>

  </target>

</project>

4. 在eclipse中,运行该ant文件即可。(右键点build.xml -> Run as -> Ant build)
5. 看Console窗口里的提示,直到显示 BUILD SUCCESSFUL
6. 然后就是安装了,Location处,点"Local...",选择build.xml中定义的目录即可(E:/eclipse_plugins_repo)


Go to "Externals Tools Configuration". Choose your ant script. Go to "JRE" tab and select "Run in the same JRE as the workspace"

build.xml内容讲解

1 <property name="working.dir" value="E:/eclipse_plugins_repo" />

这里定义了下载的插件的保存路径,可自行修改

1 <repository name="egit" location="http://download.eclipse.org/egit/updates" />

这里定义了一个repository,name任意,location为相应的update地址。可自行添加

1 <slicingOptions includeFeatures="true" followStrict="true" latestVersionOnly="true" />

这里的latestVersionOnly="true"很关键,只下载最新的版本。因为某些插件版本很多,如果不写的话,将会全部下载,吓死人


注意,在安装时,一定要把这个万恶的勾去掉。不然它会先到所有你填写过的update site中去找插件更新,卡半个小时一个小时却一点用处也没有。

附录  一下插件的 更新地址

    <repository name="color-theme" location="http://eclipse-color-theme.github.com/update" />
    <repository name="scala-ide" location="http://download.scala-ide.org/releases-29/stable/site" />
    <repository name="egit" location="http://download.eclipse.org/egit/updates" />
    <repository name="pydev" location="http://pydev.org/updates" />
    <repository name="anyedit" location="http://andrei.gmxhome.de/eclipse/" />
    <repository name="m2" location="http://download.eclipse.org/technology/m2e/releases" />
    <repository name="eclispe-wiki" location="http://www.stateofflow.com/UpdateSite" />
    <repository name="zen-coding" location="http://zen-coding.ru/eclipse/updates/" />
    <repository name="subclipse" location="http://subclipse.tigris.org/update_1.8.x" />
    <repository name="xtend" location="http://download.eclipse.org/modeling/tmf/xtext/updates/composite/milestones" />
    <repository name="checkstyle" location="http://eclipse-cs.sf.net/update/" />
    <repository name="ebean" location="http://www.avaje.org/eclipseupdate" />
  

猜你喜欢

转载自summary.iteye.com/blog/1952517