What is the natural start order for package-dependent OSGI bundles (under Karaf)?
===

I have a problem on 2.2.8 version of Karaf (and most probably on the earlier versions too). 

I'm going to use Karaf to host the system with dynamically deployed bundles. Bundles are deployed by users and i cannot know beforehand which are they. 

I expect order of the BundleActivator.start() to exactly correspond to package dependencies between bundles (dependencies of import/export packages) and planning to expect that it will be safe to assume that bundle0 will be completely initialized before bundle1 is going to be started. But it is not so - it seems that BundleActivator.start() is invoked in a "random" order and disregards package dependencies between bundles. 

Sample use-case, I have 3 libs 

    test-lib0 - defines testlib0.ITestRoot, exports testlib0 package 
    test-lib1 - defines testlib1.TestRoot implements ITestRoot,  exports testlib1 package 
    test-lib2 - uses both libs, ITestRoot and TestRoot 

When Karaf is started, i see following sample output in console 

    karaf@root> TestLib1Activator.start() 
    TestLib2Activator.start() 
            ITestRoot: interface com.testorg.testlib0.ITestRoot - 16634462 
            TestRoot:  class com.testorg.testlib1.TestRoot - 21576551 
    TestLib0Activator.start() 

but i expect it should be always in this order 

    TestLib0Activator.start() 
    TestLib1Activator.start() 
    TestLib2Activator.start() 
            ITestRoot: interface com.testorg.testlib0.ITestRoot - 16634462 
            TestRoot:  class com.testorg.testlib1.TestRoot - 21576551 

I'm attaching sample project for tests. Test case: after "mvn install" just move jars from ./deploy folder to the same folder of Karaf, trace messages should appear in console. 
(Note: it may work correctly from the first attempt, try one more time then :)) 

Sample test project
http://karaf.922171.n3.nabble.com/file/n4025256/KarafTest.zip

Note: this is cross-post from http://karaf.922171.n3.nabble.com/What-is-the-natural-start-order-for-dependent-bundle-td4025256.html