我需要帮助将依赖项配置为可选,
使用maven-bundle-plugin:3.4.0,
在Import-packages部分中,它们引用为resolution:optional
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.4.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<instructions>
<Export-Package>*</Export-Package>
<Import-Package>
org.junit.*;/resolution=optional/,
junit.framework.*;/resolution=optional/
</Import-Package>
<_nouses>true</_nouses>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
期望生成的OSGI清单文件应该包含该库的resolution:=optional,但是更改不会反映出来。
期望: junit.framework;resolution:=optional
但是在生成的清单文件junit.framework中
在生成的清单文件中,我是否遗漏了任何配置来反映它的可选解决方案?
在调查Maven-Bundle-Plugin和BundlePlugin.java文件时,我意识到如果工件包含可选的true,那么在生成的清单文件中就会反映为resolution:=optional
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
但是前面的解决方案应该根据BundlePlugin.java源代码工作。
引导我继续前进。
发布于 2019-04-11 18:07:30
您只需删除放置在resolution=optional
周围的斜杠(/)
<Import-Package>
org.junit.*;resolution=optional,
junit.framework.*;resolution=optional
</Import-Package>
https://stackoverflow.com/questions/52115557
复制相似问题