OSGI: generate bundle-classpath in maven-bundle-plugin
I am trying to add all the jars from web-inf/lib into the Bundle-ClassPath. I saw several ways to do it, none of them is working:
1) ad开发者_运维技巧d
<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 jars one-by-one in "Bundle-ClassPath" solves the problem, but it doesn't sound like a reasonable solution.
thanks
In your first code snippet, wouldn't using <Embed-Dependency>
as you have it written work? The examples at http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html seem to indicate it would.
Also, what version of the bnd plugin are you using? These features are available as of 1.2.0+.
Working example for a classic webapp being 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
精彩评论