2008/11/27 Clemens Wilding <[EMAIL PROTECTED]>

> Hello,
>
> To create a bundle, I use the org.apache.felix maven-bundle-plugin and the
> maven-assembly-plugin. As the bundle depends
> on another bundle, I specify with the assembly-plugin to install the
> required bundle in a specified folder. This works fine.
>
> Now if I don't use the maven-bundle-plugin, the generated jar is included
> in the specified folder. But if I use the plugin,
> only a test jar is installed in this folder. I don't know if this is a
> desired behaviour or maybe a little bug, so I wrote this mail.
>

this is working as designed...

the maven-bundle-plugin is different to the maven-jar-plugin in that it does
not simply
jar up the contents of "target/classes" - instead it follows a recipe of
instructions that
define the desired content (ie.
Export-Package/Private-Package/Include-Resource)

   http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

this is because we use the Bnd tool to generate the bundle, and this tool is
designed
to pull classes and resources from a classpath into one or more bundles,
effectively
slicing the classpath into different bundles

the maven-bundle-plugin will try to map certain Maven conventions into the
relevant
Bnd instructions (for example src/main/resources -> Include-Resource)
automatically
and there are instructions that work on Maven dependencies
(Embed-Dependency)
- but it cannot know in this situation that it needs to include the file
unless you tell it

so if you want to add dependencies to the bundle you can use
Embed-Dependency:

   <Embed-Dependency>*;scope=runtime;inline=false</Embed-Dependency>
   <Embed-Directory>lib</Embed-Directory>

or you can continue with the assembly plugin and use Include-Resource to add
them
(see http://www.aqute.biz/Code/Bnd#include-resource for more detailed
instructions)

HTH

As you might need some information about my configuration, I provide some
> information about the pom.xml and the assembly file dist.xml.
>
> Regards, Clemens
>
> pom.xml:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance";
>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd";>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>org.example.trialox.scb</groupId>
>   <artifactId>tutorial1</artifactId>
>   <packaging>jar</packaging>
>   <version>0.7-SNAPSHOT</version>
>   <name>tutorial1</name>
>   <dependencies>
>       <dependency>
>           <groupId>org.trialox</groupId>
>           <artifactId>org.trialox.rdf.core</artifactId>
>           <version>0.4-SNAPSHOT</version>
>       </dependency>
>   </dependencies>
>   <build>
>       <plugins>
>           <plugin>
>               <groupId>org.apache.maven.plugins</groupId>
>               <artifactId>maven-compiler-plugin</artifactId>
>               <configuration>
>                   <source>1.6</source>
>                   <target>1.6</target>
>               </configuration>
>           </plugin>
>           <plugin>
>               <artifactId>maven-assembly-plugin</artifactId>
>               <executions>
>                   <execution>
>                       <id>assembly</id>
>                       <phase>package</phase>
>                       <goals>
>                           <goal>assembly</goal>
>                       </goals>
>                       <configuration>
>                           <descriptors>
>
> <descriptor>src/assembly/dist.xml</descriptor>
>                           </descriptors>
>                       </configuration>
>                   </execution>
>               </executions>
>           </plugin>
>           <plugin>
>               <groupId>org.apache.maven.plugins</groupId>
>               <artifactId>maven-jar-plugin</artifactId>
>               <configuration>
>                   <archive>
>                       <manifest>
>
> <mainClass>org.example.trialox.scb.tutorial1.App</mainClass>
>                           <addClasspath>true</addClasspath>
>                           <classpathPrefix>lib</classpathPrefix>
>                       </manifest>
>                   </archive>
>               </configuration>
>           </plugin>
>                       <!-- <plugin>
>               <groupId>org.apache.felix</groupId>
>               <artifactId>maven-bundle-plugin</artifactId>
>               <extensions>true</extensions>
>               <configuration>
>                   <instructions>
>
> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
>                   </instructions>
>               </configuration>
>           </plugin> -->
>       </plugins>
>   </build>
> </project>
>
> dist.xml:
>
>
> <assembly>
>   <id>dist</id>
>   <formats>
>       <format>dir</format>
>   </formats>
>   <includeBaseDirectory>false</includeBaseDirectory>
>   <fileSets>
>       <fileSet>
>           <directory>target</directory>
>           <outputDirectory></outputDirectory>
>           <includes>
>               <include>*.jar</include>
>           </includes>
>       </fileSet>
>   </fileSets>
>   <dependencySets>
>       <dependencySet>
>           <outputDirectory>/lib</outputDirectory>
>           <unpack>false</unpack>
>           <scope>runtime</scope>
>       </dependencySet>
>   </dependencySets>
> </assembly>
>
> --
>
> --trialox ag--------------------------------------
>
> Clemens Wilding
> Binzmühlestrasse 14
> CH-8050 Zürich
> Tel: 0041-44-63 57577
> Fax: 0041-44-63 57574
> URL: http://www.trialox.ch
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

-- 
Cheers, Stuart

Reply via email to