1

I need maven-bundle-plugin to generate the jar with expanded dependent jars. My plugin configuration in pom.xml looks like:

<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 works for this. but Is there some way this can be achieved using maven-bundle Plugin?

4

1 回答 1

2

bundle 插件有一个配置选项来内联(扩展)依赖 jar 的类,而不是嵌入 jar 本身:

    <Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>

这在插件文档的“嵌入依赖项”部分的底部提到。

于 2018-11-28T11:30:36.640 回答