繁体   English   中英

OSGI:在maven-bundle-plugin中生成bundle-classpath

[英]OSGI: generate bundle-classpath in maven-bundle-plugin

我试图将所有的jar从web-inf / lib添加到Bundle-ClassPath中。 我看到了几种方法,但是都没有用:

1)添加

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

2)添加

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

当然,在“ Bundle-ClassPath”中一对一地编写jars可以解决此问题,但这听起来并不是一个合理的解决方案。

谢谢

在您的第一个代码段中,您编写的工作不会使用<Embed-Dependency>吗? http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html上的示例似乎表明了。

另外,您使用的是哪个版本的bnd插件? 这些功能自1.2.0+起可用。

OSGified经典Webapp的工作示例

<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>

请注意, Embed-Dependencyinstructions元素内

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM