环境描述:
组件三个,Summer3.0.0,Summer4.0.0,Autum3.0.0
依赖关系: Autum3.0.0依赖Summer3.0.0
MANIFEST文件分别如下:
Summer4.0.0:
[color=olive]Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Summer Plug-in
Bundle-SymbolicName: Summer
Bundle-Version: 4.0.0
Bundle-Activator: summer.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: summer.core;version="4.0.0"[/color]
Summer3.0.0:
Manifest-Version: 1.0
[color=green]Bundle-ManifestVersion: 2
Bundle-Name: Summer Plug-in
Bundle-SymbolicName: Summer
Bundle-Version: 3.0.0
Bundle-Activator: summer.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: summer.core;version="3.0.0"[/color]
Autum3.0.0
[color=blue]
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Autum Plug-in
Bundle-SymbolicName: Autum
Bundle-Version: 3.0.0
Bundle-Activator: autum.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0",
summer.core;version="3.0.0"
Require-Bundle: Summer;bundle-version="3.0.0"
[/color]
介绍完了环境,下面开始正常的依赖性测试:
1.初始化Equinox Framework
[color=violet]C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
osgi>[/color]
2.只安装Autum3.0.0,运行,出错是正常的:
[color=red]osgi> install reference:file:c:\temp\plugins\Autum_3.0.0.jar
Bundle id is 24
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 INSTALLED Autum_3.0.0
osgi> start 24
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Mi
ssing Constraint: Require-Bundle: Summer; bundle-version="3.0.0"
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:294)[/color]
3.在之前基础上再安装Summer3.0.0,运行,是可以成功的:
[color=green]osgi> install reference:file:c:\temp\plugins\Summer_3.0.0.jar
Bundle id is 25
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 INSTALLED Autum_3.0.0
25 INSTALLED Summer_3.0.0
osgi> start 24
version 3,addPortfolio
version 3,addPartner
version 3,removePortfolio
osgi>[/color]
4.安装Summer4.0.0,停止Autum3.0.0,重启Equinox Framework,启动Autum3.0.0:
[color=blue]C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 RESOLVED Autum_3.0.0
25 RESOLVED Summer_3.0.0
26 INSTALLED Summer_4.0.0
osgi> start 24
version 3,addPortfolio
version 3,addPartner
version 3,removePortfolio
osgi>[/color]
5.重新初始化Equinox Framework,卸载所有应用,重启,按刚才次序把三个应用全部装上:
[color=red]
C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
osgi> install reference:file:c:\temp\plugins\Autum_3.0.0.jar
Bundle id is 27
osgi> install reference:file:c:/temp/plugins/Summer_3.0.0.jar
Bundle id is 28
osgi> install reference:file:c:/temp/plugins/Summer_4.0.0.jar
Bundle id is 29
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
27 INSTALLED Autum_3.0.0
28 INSTALLED Summer_3.0.0
29 INSTALLED Summer_4.0.0
osgi> start 27
version 4,addPortfolio
version 4,addPartner
version 4,removePortfolio
osgi>[/color]
结果是[size=24][b][color=darkred]Autum3.0.0跑去抢Summer4.0.0的东西去[/color][/b][/size]了,这是为什么呢,难道是Equinox实现的bug?
组件三个,Summer3.0.0,Summer4.0.0,Autum3.0.0
依赖关系: Autum3.0.0依赖Summer3.0.0
MANIFEST文件分别如下:
Summer4.0.0:
[color=olive]Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Summer Plug-in
Bundle-SymbolicName: Summer
Bundle-Version: 4.0.0
Bundle-Activator: summer.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: summer.core;version="4.0.0"[/color]
Summer3.0.0:
Manifest-Version: 1.0
[color=green]Bundle-ManifestVersion: 2
Bundle-Name: Summer Plug-in
Bundle-SymbolicName: Summer
Bundle-Version: 3.0.0
Bundle-Activator: summer.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0"
Export-Package: summer.core;version="3.0.0"[/color]
Autum3.0.0
[color=blue]
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Autum Plug-in
Bundle-SymbolicName: Autum
Bundle-Version: 3.0.0
Bundle-Activator: autum.Activator
Bundle-Localization: plugin
Import-Package: org.osgi.framework;version="1.3.0",
summer.core;version="3.0.0"
Require-Bundle: Summer;bundle-version="3.0.0"
[/color]
介绍完了环境,下面开始正常的依赖性测试:
1.初始化Equinox Framework
[color=violet]C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
osgi>[/color]
2.只安装Autum3.0.0,运行,出错是正常的:
[color=red]osgi> install reference:file:c:\temp\plugins\Autum_3.0.0.jar
Bundle id is 24
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 INSTALLED Autum_3.0.0
osgi> start 24
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Mi
ssing Constraint: Require-Bundle: Summer; bundle-version="3.0.0"
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:294)[/color]
3.在之前基础上再安装Summer3.0.0,运行,是可以成功的:
[color=green]osgi> install reference:file:c:\temp\plugins\Summer_3.0.0.jar
Bundle id is 25
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 INSTALLED Autum_3.0.0
25 INSTALLED Summer_3.0.0
osgi> start 24
version 3,addPortfolio
version 3,addPartner
version 3,removePortfolio
osgi>[/color]
4.安装Summer4.0.0,停止Autum3.0.0,重启Equinox Framework,启动Autum3.0.0:
[color=blue]C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
24 RESOLVED Autum_3.0.0
25 RESOLVED Summer_3.0.0
26 INSTALLED Summer_4.0.0
osgi> start 24
version 3,addPortfolio
version 3,addPartner
version 3,removePortfolio
osgi>[/color]
5.重新初始化Equinox Framework,卸载所有应用,重启,按刚才次序把三个应用全部装上:
[color=red]
C:\temp>java -jar org.eclipse.osgi_3.2.0.v20060601.jar -console
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
osgi> install reference:file:c:\temp\plugins\Autum_3.0.0.jar
Bundle id is 27
osgi> install reference:file:c:/temp/plugins/Summer_3.0.0.jar
Bundle id is 28
osgi> install reference:file:c:/temp/plugins/Summer_4.0.0.jar
Bundle id is 29
osgi> ss
Framework is launched.
id State Bundle
0 ACTIVE system.bundle_3.2.0.v20060601
27 INSTALLED Autum_3.0.0
28 INSTALLED Summer_3.0.0
29 INSTALLED Summer_4.0.0
osgi> start 27
version 4,addPortfolio
version 4,addPartner
version 4,removePortfolio
osgi>[/color]
结果是[size=24][b][color=darkred]Autum3.0.0跑去抢Summer4.0.0的东西去[/color][/b][/size]了,这是为什么呢,难道是Equinox实现的bug?