4

我正在尝试将 web-inf/lib 中的所有 jar 添加到 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”中一个一个地写jar可以解决问题,但听起来不是一个合理的解决方案。

谢谢

4

2 回答 2

6

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

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

于 2011-01-30T13:56:30.427 回答
1

OSGified 的经典 web 应用的工作示例

<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元素内部

于 2014-01-28T19:52:34.033 回答