OSGI: bundles, class inheritance and maven scope

不想你离开。 提交于 2019-12-11 12:45:26

问题


I have three maven projects as three osgi bundles (that is one project is one bundle). And I have three classes - one class in each bundle.

Project/Bundle 1:
class A{}
pom:    

Project/Bundle 2:
class B extends A{}
pom:
 <dependency>
     <groupId>com.company</groupId>
     <artifactId>project1</artifactId>
     <version>1.0.0</version>
     <scope>provided</scope>
</dependency>

Project/Bundle 3
class C extends B{}
pom:
 <dependency>
     <groupId>com.company</groupId>
     <artifactId>project2</artifactId>
     <version>1.0.0</version>
     <scope>provided</scope>
</dependency>

Why when I compile project3 I get exception that class A can't be accessed? The problem is solved only adding project1 as dependency to project 3. But, why?


回答1:


It is because of the provided scope. It breaks the transitive lookup.



来源:https://stackoverflow.com/questions/37360132/osgi-bundles-class-inheritance-and-maven-scope

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!