我需要使用maven-bundle-plugin生成具有扩展依赖罐的罐。 我在pom.xml中的插件配置如下:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<manifestLocation>${project.build.outputDirectory}/META-INF/</manifestLocation> <!-- make sure this is present! in the example of maven bundle plugin documentation, this piece is NOT present -->
<exportScr>true</exportScr> <!-- be sure to add this line as well -->
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<_dsannotations>*</_dsannotations>
<!-- we explicitly import the interfaces package, not the implementations, otherwise we get into dependency and version hell -->
<Import-Package>com.ooo.dis.common.extensions.interfaces;version=${platformVersion},com.ooo.dis.analysis.common.interfaces;version=${platformVersion},javax.json,javax.ws.rs.client</Import-Package>
<Build-Timestamp> ${maven.build.timestamp}</Build-Timestamp>
<Include-Resource>{maven-resources},schemes=target/classes/schemes</Include-Resource><!-- override schemes with the one generated by the processor -->
<Embed-Dependency>*</Embed-Dependency>
</instructions>
</configuration>
</plugin>
maven-assembly-plugin为此工作。但是有什么方法可以使用maven-bundle插件来实现?
答案 0 :(得分:1)
bundle插件具有config选项,以内联(扩展)依赖项jar的类,而不是将jar本身嵌入:
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
在plugin doc的“嵌入依赖项”部分的底部提到了这一点。