OSGI Felix does not export src / main / resource files

Since we know that with defaul osgi export-package exports only the package from the src / main / java folder, but I need another form of the src / main / resource file that will also be exported for use by other projects. Below is an example of my

ProjectA (packaging type - jar)

src/main/java
                x.y.z.SomeClass.java
src/main/resource 
                x.y.z.config.SomeConfigFile.xml


pom.xml contains 
    <Export-Package>
        x.y.z.*,
        x.y.z.config.*,
        *
    </Export-Package>

ProjectB (packaging type - bundle)

src/main/java
                a.b.c.AnotherClass.java
src/main/resource 
                a.b.c.config.AnotherConfigFile.xml


pom.xml contains 
    <Import-Package>
        x.y.z.*,
        x.y.z.config.*,
        *
    </Import-Package>

My requirement here is to use SomeConfigFile.xml ProjectA in AnotherConfigFile.xml projectB, but I always get a FileNotFoundException for the above scenario. Please help me use the src / main / resource classpath class files in another osgi project. How can I achieve the above scenario.

+4
2

, Include-Resource Import-Package. ( "" ): http://www.aqute.biz/Bnd/Format.

+1

( , , )

  • java, Import-Package. .
  • , META-INF, "-" . : '= META-INF.subdir'
  • , , bundle.getResource(), . classLoader listResources BundleWiring.
+1

Source: https://habr.com/ru/post/1530988/


All Articles