eclipse上构建spring与OSGI项目

eclipse下构建spring与OSGI项目

1.准备工作。

下载springframework2.5.6包。

取得文件spring-context.jar,spring-aop.jar,spring-beans.jar

下载spring-osgi1.2包。

取得文件spring-osgi-core-1.2.0.jar,spring-osgi-extender-1.2.0.jar,spring-osgi-io-1.2.0.jar

 

2.

eclipse下new-> Plug-in from existing JAR archives-> Add External
选择上述包,新建一个项目(如名:spring-depends)

 

新建Plugin-in Project,Target Platform选择Equinox,如名:osgi-spring-test

 

在Required-Bundle中

   添加之前的项目(如名:spring-depends)

   添加org.eclipse.osgi.util(3.1.300)

   添加org.eclipse.osgi(3.4.3)

   在Import-Packages中添加org.osgi.framework(1.4.0)

   添加DynamicImport-Package: *

 

3.

创建一个OSGi Framework类型的运行项 在(右侧)的Bundles里面,去掉不相关的bundle,保留以下:

org.apache.commons.logging

javax.servlet

org.eclipse.equinox.http.jetty

org.eclipse.equinox.http.servlet

org.eclipse.osgi

org.eclipse.osgi.services

org.mortbay.jetty

"Spring依赖项(如名:spring-depends)"

"Spring OSGI项目(如名:osgi-spring-test)"

 

note:

in eclipse 3.6, above list will be:

org.apache.commons.logging

javax.servlet

org.eclipse.equinox.http.jetty

org.eclipse.equinox.http.servlet

org.eclipse.osgi

org.eclipse.osgi.services

org.eclipse.osgi.util

org.mortbay.jetty.server

org.mortbay.jetty.util

"Spring依赖项(如名:spring-depends)"

"Spring OSGI项目(如名:osgi-spring-test)"

 

4.通过以上,Spring 的运行环境已经构建完成。
以后只需要专心开发就可以了。

:)