使用 Maven-bundle-plugin,我如何将依赖的 jar 打包为 .class(提取的 jar)
Using Maven-bundle-plugin, how can i package dependent jars as .class (extracted jars)
我需要 maven-bundle-plugin 来生成带有扩展依赖 jar 的 jar。
我在 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 插件来实现吗?
bundle 插件有一个配置选项,用于内联(扩展)依赖 jar 的 类 而不是嵌入 jar 本身:
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
这在 plugin doc 中 "Embedding dependencies" 部分的底部提到。
我需要 maven-bundle-plugin 来生成带有扩展依赖 jar 的 jar。 我在 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 插件来实现吗?
bundle 插件有一个配置选项,用于内联(扩展)依赖 jar 的 类 而不是嵌入 jar 本身:
<Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>
这在 plugin doc 中 "Embedding dependencies" 部分的底部提到。