OSGI: create package class path in maven-bundle-plugin

I am trying to add all banks from web-inf / lib to Bundle-ClassPath. I saw several ways to do this, none of them work:

1) add

<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency> <Embed-Directory>WEB-INF/lib</Embed-Directory> <Embed-Transitive>true</Embed-Transitive> 

2) add

 <Bundle-ClassPath>.,{maven-dependencies},WEB-INF/classes</Bundle-ClassPath> 

Of course, writing banners one by one in Bundle-ClassPath solves the problem, but that doesn't seem like a reasonable solution.

thanks

+4
source share
2 answers

In your first code snippet will not use <Embed-Dependency> , since you have a written work? The examples in http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html seem to indicate this.

Also, what version of the bnd plugin are you using? These features are available from 1.2.0+.

+6
source

Working example for classic webapp, OSGified

 <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> <executions> <execution> <id>bundle-manifest</id> <phase>process-classes</phase> <goals> <goal>manifest</goal> </goals> <configuration> <instructions> <Private-Package>org.example</Private-Package> <Web-ContextPath>webappcontextpath</Web-ContextPath> <Bundle-ClassPath>.,WEB-INF/classes,{maven-dependencies}</Bundle-ClassPath> <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> <Embed-Directory>WEB-INF/lib</Embed-Directory> </instructions> <supportedProjectTypes> <supportedProjectType>war</supportedProjectType> </supportedProjectTypes> </configuration> </execution> </executions> </plugin> 

Note that Embed-Dependency is inside the instructions element

+1
source

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


All Articles