What I mean is that there were no dependencies at all being pulled in to
the bundle - either explicit or transitive. I have purposely made the
"eclipse-deps" dependency "provided" scope because I really do not want
them to show up in the bundle. I also do not want any transitive
dependencies included, either. All I wanted to be included were the 5
explicit dependencies that were listed without any scope. However, none of
them was being included - the only stuff in the bundle were the classes
that were directly part of this module.

In any case, I tried making the changes that you suggested to the
Embed-Dependency tag and adding the Embed-Transitive tag. Sure enough, now
I got all kinds of stuff, including the transitive dependencies that I did
not want. Then I had a thought - I removed the transitive specification but
kept your suggested version of the Embed-Dependencies tag. Success! Now the
bundle has the dependencies I want, so there is apparently a bug that gets
worked around by using the "type=" specification!

However, there is a bizarre thing going on still: the bundle has the JARs I
want in its root directory, but they are also unpacked inside it. So, I
have a JAR with two copies of everything I want - one inside another set of
JARs, and one directly in the bundle's JAR. How can I stop that from
happening? I would be OK with it having just the JARs inside the bundle
(because WPS will unpack inner JARs at bundle deploy time), but however it
works, I definitely don't want two copies of everything.

Thanks for your help so far - I'm a lot farther along than I was yesterday.

Jim Babka
S/W Engineer, Industry SOA Accelerators
(512)838-8180
[EMAIL PROTECTED]


                                                                       
             "Stuart                                                   
             McCulloch"                                                
             <[EMAIL PROTECTED]                                          To
             m>                        [email protected]          
                                                                        cc
             09/16/2008 11:48                                          
             PM                                                    Subject
                                       Re: Embed-Dependency doesn't work
                                                                       
             Please respond to                                         
             [EMAIL PROTECTED]                                         
                   e.org                                               
                                                                       
                                                                       




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