建立一個本地的Eclipse Update Site

來源:互聯網
上載者:User

原文出處: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).

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.