创建一个本地的Eclipse Update Site

原文出处:http://twasink.net/blog/archives/2004/07/creating_a_loca.html。被和谐了,需要用XeroBank Browser(原来叫torpark)才能够访问到。本文翻译未得到原作者同意。

翻译内容如下:

 

在第二遍完成这个事情之后,我想我要给出一个详细步骤来告诉大家创建一个Eclipse的更新站点了,然后把现有的插件放上去。在本例中,我将构建一个Weblogic插件的更新站点。

创建一个更新站点

如果你已经有了一个更新站点了,那就跳过这一步吧。否则,你需要在web服务器的某个位置创建一个目录。这个目录的位置我们在文中用$update-dir来表示。

在这个目录中,你需要创建一个叫site.xml的文件,暂时我们还不要加内容,所以是一个空文件:

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

然后在这个目录下创建两个子目录,plugins和features。

安装本地插件

下载插件并且在本地安装好,简单复制到$ECLIPSE_HOME/plugins即可。插件名字叫com.bea.eclipse.weblogic_1.1.1

随后,启动eclipse并且确认这个插件能够正常工作。如果还不能正常工作,收拾一下回家哄孩子去吧:)。

上传插件

很不幸,eclipse更新站点不能抓取插件里边包含的子目录。所以我们需要把插件打包成jar。要注意确保你已经保留了Manifest信息。命令如下:

jar cvMf com.bea.eclipse.weblogic_1.1.1.jar -C com.bea.eclipse.weblogic_1.1.1

拷贝打包之后的jar文件到$update_dir/plugins目录。

创建feature定义

可能有些插件会没提供feature定义,我们就需要自己创建一个,还好难度不大。

在$update-dir/features目录中创建一个和插件同名的目录,比如com.bea.eclipse.weblogic_1.1.1。然后在这个目录中创建一个feature.xml文件。内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<feature id="com.bea.eclipse.weblogic" label="Weblogic Plugin"
version="1.1.1" provider-name="BEA Systems">
<description>
This is a plugin to control a local Weblogic instance from
within Eclipse.
</description>

<license>
None mentioned
</license>

<url>
<update label="My Update Site" url="http://[server]eclipse-updates/"/>
</url>

<plugin id="com.bea.eclipse.weblogic" download-size="0" install-size="0" version="1.1.1"/>
</feature>

回到$update-dir/features目录并且把你刚才创建的目录放到一个jar文件中,比如:

jar cvf com.bea.eclipse.weblogic_1.1.1.jar -C com.bea.eclipse.weblogic_1.1.1

执行完了之后,那个目录就不再需要了,可以删掉它。

更新site.xml文件

现在你需要使用site.xml发布新特性了。新文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<site>
<description url="http:///eclipse-updates">
My Eclipse Update Server
</description>
<feature url="features/com.bea.eclipse.weblogic_1.1.1.jar" id="com.bea.eclipse.weblogic" version="1.1.1" >
<category name="App Server" />
</feature>
<category-def name="App Server" label="Application Server">
<description>Tools to control Application Servers</description>
</category-def>
<site>

就这么多。现在你需要做的仅仅是让你的eclipse从更新站点下载并安装这个插件了(别忘记先把你刚才本地安装的插件删掉)。

 

 

原文内容如下:

Creating a local Eclipse Update site

After having to work out how to do this again, I thought I'd give a step-by-step guide to creating an Eclipse Update site, populated by existing plugins. For this example, I'll create an update site for the Weblogic Eclipse plugin.

Create the update site

If you've already got one of these, skip this step. Otherwise, you'll need to create a directory on a webserver somewhere. This is referred to afterwards as $update-dir.

In this is directory, you'll need to create a file called 'site.xml'. Because you don't have any thing there yet, this is pretty empty:

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

Create two directories underneath this one called plugins and @features.

h2.Install the plugin locally

Download the plugin and install it locally, by copying it to $ECLIPSE_HOME/plugins; the plugin is called com.bea.eclipse.weblogic_1.1.1

After this step, quickly start Eclipse and make sure the plugin is working. If it's not, pack up and go home. :)

Transform the plugin

Eclipse Update sites can't take plugin directories, unfortunately. So we need to package the plugin into a JAR. It is important to make sure you preserve the Manifest information. The command I used was:

jar cvMf com.bea.eclipse.weblogic_1.1.1.jar -C com.bea.eclipse.weblogic_1.1.1

Copy the jar file to $update-dir/plugins

Create a feature definition.

Odds are the plugin hasn't come with a feature definition, so you need to make one of those. It's not hard, however.

In $update-dir/features, create a directory with the same name as the plugin, e.g. com.bea.eclipse.weblogic_1.1.1. Then create a file called feature.xml in this new directory. The contents of the file look like this:

<?xml version="1.0" encoding="UTF-8"?>
<feature id="com.bea.eclipse.weblogic" label="Weblogic Plugin"
version="1.1.1" provider-name="BEA Systems">
<description>
This is a plugin to control a local Weblogic instance from
within Eclipse.
</description>

<license>
None mentioned
</license>

<url>
<update label="My Update Site" url="http://[server]eclipse-updates/"/>
</url>

<plugin id="com.bea.eclipse.weblogic" download-size="0"
install-size="0" version="1.1.1"/>
</feature>

Back out to the $update-dir/features directory and turn the directory you just made into a JAR. e.g.
bc. jar cvf com.bea.eclipse.weblogic_1.1.1.jar -C com.bea.eclipse.weblogic_1.1.1

After this you can delete the directory if you want.

Update the site.xml file.

You now need to publish the new feature by updating the site.xml file. The new file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<site>
<description url="http:///eclipse-updates">
My Eclipse Update Server
</description>
<feature url="features/com.bea.eclipse.weblogic_1.1.1.jar" id="com.bea.eclipse.weblogic" version="1.1.1" >
<category name="App Server" />
</feature>
<category-def name="App Server" label="Application Server">
<description>Tools to control Application Servers</description>
</category-def>
<site>

And that's it. All you need to do now is point your Eclipse installation at the update site and download the feature (though you probably want to delete the locally installed plugin first).

posted on 2007-09-27 18:08  老翅寒暑  阅读(5680)  评论(1编辑  收藏  举报

导航