Using Maven-bundle-plugin, how can i package dependent jars as .class (extracted jars)

1.4k views Asked by At

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?

1

There are 1 answers

0
gjoranv On BEST ANSWER

The bundle plugin has a config option to inline (expand) the classes of dependency jars instead of embedding the jars themselves:

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

This is mentioned at the bottom of the "Embedding dependencies" section in the plugin doc.