在Nexus OSS上建Eclipse p2 repository

Eclipse p2使用了特殊的repository Layout(其实我认为就是所谓的”Update Site”)。它有别于一般的maven2 layout, Maven 3可以支持,maven tycho也可以很好的支持。但每次都要连接Eclipse的中央仓库,速度是一个问题,稳定性很不好(尤其在中国),有时会断掉。

为了解决这个问题,我尝试地在公司内部搭建了Nexus OSS,并建立了Eclipse p2的Proxy repository。

搭建Nexus OSS

Nexus OSS是流行且免费的部署私有Maven Repository的工作。安装很简单,从官网上下载最新的版本,解压,再运行$install_folder/bin/nexus start. 这个命令还不需要root权限。

TIP:最好把JVM最大内存调整一下。修改$install_folder/bin/jsw/conf/wrapper.conf, 找到wrapper.java.initmemorywrapper.java.maxmemory,分别调大一些。我的配置分别是256和1024.

安装p2的扩展

默认的Nexus OSS是不支持p2 layout的。需要在Sonatype RSO上下载相关的扩展。打开Sonatype RSO网页,搜索nexus-p2-bridge-pluginnexus-p2-repository-plugin两个扩展,我选择了2.6.3-01版本,分别下载它们的bundle zip(包含了dependencies)。再解压到$install_folder/nexus/WEB-INF/plugin-repository,然后重启Nexus OSS ($install_folder/bin/nexus restart).

配置p2 proxy repository

admin登录后,进入Repositories,选择Add->Proxy Repository,

在打开的设置页面里,输入repository id, repository name, format要选择p2, 还有设置Remote Storage Location。我的例子中选择了Eclipse Indigo.

Nexus会生成新的Repository Link,它和Remote Location可以一样使用。第一次的Index要慢一些。

其他用处

新产生的Link还可以帮助定义Target Platform。做Eclipse RCP开发的Team一定会遇到统一Target Platform的问题,说白了就是全组人的目标平台环境要完全一样。默认情况下,Target Platform是和IDE一样,所以如果A用Eclipse 4.3, B用Eclipse 3.7,可想而知那是多么混乱。

Eclipse PDE想到了这个问题,我们可以定义Target文件,在里面详细定义目标平台的构成,包含哪些Feature,哪些Plugin。有了内部的Repository,在Target文件里可以直接引用相应的连接,非常的稳定!

总结

Nexus OSS里可以添加p2 proxy repository,可以大大提高项目在编译时的速度和稳定性,提高生产效率。但它不支持做Host Repository,那是Pro版本里的功能。

 

 

Integrate VisualVM with Eclipse IDE

Recently I got a task to evaluate sqlite, which is a good candidate for our new product. I wrote several samples in Eclipse IDE and run several cases to test its features and  use VisualVM to test its performance.

VisualVM is a lightweight profiling tool which is released with JDK now. It’s quite handy for easy cases. And it’s quite easy to integrate it with your Eclipse IDE.

First, go to visualvm website and download the launcher for Eclipse.

Unzip the launcher and Install it by Eclipse Update Center.

Restart your Eclipse and go to Run Configuration, you will find there is a new launcher for VisualVM. After switching to it, your run is connected with VisualVM now.

😀

把Linux开发环境搬到Virtual Machine里

好久没来写东西,一是项目太紧,一是懒。这两天得空把现有的开发环境改进了一下,把Linux开发环境从公司的开发机上搬到了VM里。

原因有几点:

  • 原来Linux的开发机是共用的,人一多,机子就卡。毕竟同时运行几个Eclipse啊。
  • Linux开发机要用NXClient连接。NXClient能保存Session,很方便,但时不时的就把Mouse Focus给锁了,非常坑爹!已经N次Kill NXClient进程,再把各种窗口工具一一打开。
  • 为了一些技术改进,我在开发机上装了两个Web-Based App。少一个人用开发机,多空出点资源。
  • VM自己控制,可以装一些方便的工具。
  • 回家VPN太卡,VM更灵活,断了网了也不怕。

VM很容易装,Linux Distribution和开发机保持一致,再把自己在开发机上的Home目录Mount过来就一切搞定了。

现在很Happy!