OSGI:包,类继承和Maven范围 [英] OSGI: bundles, class inheritance and maven scope

查看:98
本文介绍了OSGI:包,类继承和Maven范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个Maven项目作为3个osgi捆绑软件(也就是说,一个项目就是1个捆绑软件).我有3个班级-每个捆绑包中有1个班级.

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>

为什么在编译project3时出现无法访问类A的异常?仅通过将project1作为依赖项添加到项目3即可解决该问题.但是,为什么?

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?

推荐答案

这是因为提供了范围.它破坏了传递查询.

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

这篇关于OSGI:包,类继承和Maven范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆