java - Maven: class not found compiling osgi bundle -


i have 3 osgi projects:

projecta (has dependency projectb <scope>provided</scope>) has class code

... classb b=new classb(); 

projectb (has dependency projectc <scope>provided</scope>) has following class:

public class classb extends abstractclassc{ ... } 

projectc has following class:

public abstract class abstractclassc{ } 

projectb , projectc export necessary packages.

in order:

  1. i compile projectc - ok.
  2. i compile projectb - ok.
  3. i compile projecta - throws abstractclassc not found.

when add in projecta dependency projectc compiles without problem. why happen? understand projecta must compiled 1 dependency projectb. wrong?

i've checked several times abstractclassc not used in projecta , not imported.

first of all, can't make instance of classb unless know abstractclassc, code won't compile without reference.

the main problem you're having, though, <scope>provided</scope> not transitive:

  • provided - compile, indicates expect jdk or container provide dependency @ runtime. example, when building web application java enterprise edition, set dependency on servlet api , related java ee apis scope provided because web container provides classes. scope available on compilation , test classpath, , is not transitive.

why using provided classes you've written yourself? use compile, fix issue. alternatively, add projectc dependency projecta.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -