![](/img/trans.png)
[英]Is there a way to modify a jar with a wrong manifest using the maven-bundle-plugin?
[英]How to identify the source of a package version in the Manifest generated by maven-bundle-plugin
我正在使用maven-bundle-plugin從Maven模塊創建一個OSGI包。
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Import-Package>
*
</Import-Package>
<Export-Package>
my.bundle.packages
</Export-Package>
</instructions>
</configuration>
</plugin>
不幸的是,似乎存在一個暴露javax.annotation的依賴項。 因此,生成的Manifest包含Import-Package: javax.annotation;version="[3.2,4)"
如何找出哪個依賴項導出此包? 通過使用mvn dependency:list
我已經能夠排除一些依賴項(com.google.code.findbugs:annotations和com.google.code.findbugs:jsr305),但版本范圍仍然存在。 我一直在查看直接依賴項的Manifest文件,但是沒有找到任何其他jar導出javax.annotation。
注意:我可以在javax.annotation中添加一個依賴項:com.springsource.javax.annotation,並且Manifest會正確導入javax.annotation版本1.0.0,但這不是必需的,我個人會覺得排除它更清晰未知依賴。
如何找出哪個依賴項導出此包?
如果您安裝了* nix console和bnd
命令行工具,您可以嘗試:
mvn dependency:build-classpath | grep jar | tr ':' ' ' | xargs bnd find -e 'javax.annotation'
可能有更好的方法來做到這一點,但這是一個凝視點
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.