1、eclipse中安装plug-in project
步骤一:进入eclipse菜单Help->Install New Software
步骤二:"Work With:" -> "--All Available Sites--","type" >"Plug-in"
步骤三:过滤项中安装:"Eclipse Plug-in Development Environment",重启eclipse
2、eclipse中创建一个"plug-in Project"工程
步骤一:new > New Project > plug-in Project
步骤二:创建一个工程为"com.project.test",Target Platform > This plug-in is targeted to run with 选择"an OGGi framework",右侧复选框选择"standard"
步骤三:后面两步选择默认,直接next,Templates项选择任意一个即可:
3、运行"com.project.test" bundle
步骤一:工程右键"Run as > Run Configurations" ,新建"OSGi Framework",名称定为"OSGi hello world",
步骤二:勾选以下组件:
com.project.test
org.apache.felix.gogo.command
org.apache.felix.gogo.runtime
org.apache.felix.gogo.shell
org.eclipse.equinox.console
步骤三:点击"Run",查看控制台
org.eclipse.osgi_3.12.100.v20180210-1608的bundleId默认为0
其他的bundleId随机分配