通过pax-construct创建spring-dm项目

通过pax-construct创建spring-dm项目,因为借助了maven,所以特别方便。有关pax-construct的准备工作,见:通过pax-construct创建osgi项目

创建项目:

pax-create-project -g com.easymorse.marshal -a spring

进入创建的项目目录,为pax设置导入spring-dm的相关包的仓库:

pax-add-repository -i com.springsource.repository.bundles.external -u http://repository.springsource.com/maven/bundles/external

导入spring-dm指定版本绑定:

pax-import-bundle -g org.springframework.osgi -a spring-osgi-extender -v 1.1.2 — -DimportTransitive -DwidenScope

创建一个osgi服务绑定:

pax-create-bundle -p org.example.service — -Djunit

创建一个spring-dm bean:

pax-create-bundle -p org.example.bean — -Dspring -Djunit

构建,使用了equinox代替了默认的felix:

mvn clean install pax:provision "-Dframework=equinox"

创建为eclipse项目:

mvn clean install pax:eclipse -DdownloadSources

最后,就是通过eclipse导入该项目。

如果以上脚本片段使用有问题,可能是页面中字符“–”被转换为“—”,可参考以下脚本附件:

[Download not found]
創建PDF格式    发送文章为PDF   

1 Comment to “通过pax-construct创建spring-dm项目”

  1. By jandyfish, 2011年04月27日 @ 19:42

    恩,很不错。但是有一个问题:
    pax-create-bundle -p org.example.service — -Djunit
    应该是:
    pax-create-bundle -p org.example.service — -Djunit
    注:一中文横线应该是两个英文小横线…(*^__^*)

这篇文章上的评论的 RSS feed TrackBack URI

Leave a Reply