2008/9/17 Jim Babka <[EMAIL PROTECTED]>

> Sorry if this is a repeat, but I didn't know where to send a post (there
> is all kinds of documentation on how to manage your subscription, but
> there's nothing that says, "send postings to this address").
>
> I am new to Felix, and am trying to use the maven-bundle-plugin to build
> an OSGi bundle that includes dependent JARs. The web page says that I
> should use the Embed-Dependency instruction to cause this to happen, but
> it is not doing anything (and in fact, the instruction is just ending up
> copied verbatim into the manifest file for the bundle).
>
> Here is the POM file that I'm using. The build succeeds, but again, none
> of my dependencies are being copied into the resulting JAR. Can anyone
> offer any clues as to what I can do to make this work?
>
> <?xml version="1.0" encoding="UTF-8"?>
> <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>
>    <parent>
>        <groupId>com.ibm.websphere.fabric</groupId>
>        <artifactId>fabric-engine-parent</artifactId>
>        <version>9.0</version>
>    </parent>
>
>    <groupId>com.ibm.websphere.fabric</groupId>
>    <artifactId>com.ibm.ws.fabric.extension</artifactId>
>    <packaging>bundle</packaging>
>    <version>9.0</version>
>    <name>Fabric extensions to be used by 3rd party code</name>
>    <description>
>      This bundle provides the Fabric extensions to WPS that are used by
> 3rd party and/or customer code.
>    </description>
>    <dependencies>
>      <dependency>
>        <groupId>com.ibm.websphere.fabric</groupId>
>        <artifactId>fabric-engine-api</artifactId>
>        <version>9.0</version>
>      </dependency>
>      <dependency>
>        <groupId>com.ibm.websphere.fabric</groupId>
>        <artifactId>fabric-types</artifactId>
>        <version>9.0</version>
>      </dependency>
>      <dependency>
>        <groupId>com.ibm.websphere.fabric</groupId>
>        <artifactId>fabric-da-model</artifactId>
>        <version>9.0</version>
>      </dependency>
>      <dependency>
>        <groupId>com.ibm.websphere.fabric</groupId>
>        <artifactId>fabric-da-sca</artifactId>
>        <version>9.0</version>
>      </dependency>
>      <dependency>
>        <groupId>com.ibm.websphere.fabric</groupId>
>        <artifactId>com.ibm.ws.fabric.da.scdl</artifactId>
>        <version>9.0</version>
>      </dependency>
>        <dependency>
>            <groupId>eclipse</groupId>
>            <artifactId>eclipse-deps</artifactId>
>            <type>pom</type>
>            <version>1.3</version>
>            <scope>provided</scope>
>        </dependency>


when you say the dependencies aren't being embedded, do you mean the ones
directly listed in this pom or the ones pulled in from the "eclipse-deps"
artifact?

if you mean the ones from "eclipse-deps" then this is probably because of
two
reasons - 1) you haven't enabled <Embed-Transitive>true<Embed-Transitive>
which is required to embed dependencies of dependencies - and 2) the scope
of the pom dependency is "provided", which means that Maven will ignore its
dependencies when calculating the transitive graph, see:

  http://www.sonatype.com/book/reference/pom-relationships.html#d0e10431

to include the "eclipse-deps" dependencies in the transitive graph you
should
just remove the <scope> from that entry, so it defaults to the compile
scope.


>        <dependency>
>            <groupId>junit</groupId>
>            <artifactId>junit</artifactId>
>            <scope>test</scope>
>        </dependency>
>    </dependencies>
>    <build>
>      <plugins>
>        <plugin>
>          <groupId>org.apache.felix</groupId>
>          <artifactId>maven-bundle-plugin</artifactId>
>          <version>1.4.3</version>
>          <extensions>true</extensions>
>          <configuration>
>            <instructions>
>              <Export-Package>com.ibm.websphere.fabric.*</Export-Package>
>              <Private-Package>com.ibm.ws.fabric.*</Private-Package>
>              <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
>
>
> <Bundle-Activator>com.ibm.ws.fabric.extensions.osgi.Activator</Bundle-Activator>
>  <Embed-Dependency>*;scope=compile|runtime;inline=true</Embed-Dependency>


so this should be:


<Embed-Dependency>*;scope=compile|runtime;type=!pom,inline=true</Embed-Dependency>
  <Embed-Transitive>true</Embed-Transitive>

note that I've also added a filter to exclude any 'pom' dependencies from
being
embedded, as otherwise the bundleplugin will try to inline them (ie. unzip
them)
and you'll see errors because an artifact with packaging 'pom' is just a
text file

HTH - let me know if it doesn't

           </instructions>
>          </configuration>
>        </plugin>
>      </plugins>
>    </build>
> </project>
>
> Jim Babka
> S/W Engineer, Industry SOA Accelerators
> (512)838-8180, T/L 678-8180
> Starting November 17, my new number will be (512)286-5195, T/L 363-5195
> [EMAIL PROTECTED]




-- 
Cheers, Stuart

Reply via email to