2009/7/14 Lewis, Eric <[email protected]>

> Hi Stuart
> > look at Embed-Dependency in
> > http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
> > to see how to pull dependencies into your plug-in - this will
> > also let you
> > filter out unwanted jars
>
> Thanks, I know it works because I've done it for individual projects
> already.
> Just to be sure: The Felix plugin doesn't download and copy any
> dependencies, right?


well it asks the Maven runtime for the list of resolved project
dependencies,
which could trigger download of missing/updated dependencies to your local
Maven repo, but it doesn't copy these dependencies to your project directory

if you use Embed-Dependency the plugin will look for matching dependencies
and add the appropriate "Include-Resource" instructions to add the jars to
the
bundle (the Bnd Tool http://aqute.biz/Code/Bnd does the adding)

but note that the Bnd Tool won't copy them to the build directory - instead
they
are added to the jar in memory, and the jar is written out at the end of the
build

also remember that the Bnd Tool only adds whatever packages/resources you
instruct it to add (ie. it doesn't simply zip up "target/classes" like the
jar plugin)

Which means I have to use the dependencies plugin to do that.
>

yes, if you want the dependency jars in the place expected by Eclipse/PDE
then you'll need to use the dependency plugin (as shown in the online docs)
or the "org.ops4j:maven-pax-plugin:eclipse" goal as used in Pax-Construct

alternatively you could unpack the bundle after it has been packaged by
using
the <unpackBundle> setting - however, the problem with this is that you'll
want
to unpack under "target" (ie. a temporary directory) but PDE expects paths
to
be relative to the project directory - so the Bundle-ClassPath won't match

this is where the "pax:eclipse" goal helps, because it munges the entries in
the
Bundle-ClassPath in the Eclipse/PDE manifest so dependencies and classes
appear to be in the right place for PDE (eg. "." becomes "target/classes",
etc.)

I'm asking because at the moment, I have 40 JAR files downloaded as
> dependencies (by the dependencies plugin), but even though I specify
> <Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
> I only have 37 JARs in there.
>

hard to say without seeing the dependency graph and your embed instruction,
do you happen to notice anything in common wrt. the missing dependencies?

btw, you don't need to set Bundle-ClassPath when embedding dependencies,
unless you want to re-order the entries - the plugin automatically updates
the
Bundle-ClassPath to include any embedded dependencies


> >
> > you can use the configuration under 'Eclipse/PDE integration'
> > to generate
> > the manifest in the place
> > that PDE expects it and arrange for embedded jars to be where
> > PDE expects
> > them (PDE basically
> > assumes the bundle is unpacked under the project directory,
> > which conflicts
> > with the Maven layout)
>
> I'm a bit confused about <Embed-Directory> - do I have to specify it for
> Felix to work correctly?
> I let the dependencies plugin download all JARs into the project root.
>

if you're using the dependency plugin to put dependent jars at the project
root
then you don't need to use <Embed-Directory> - you'd only need to use that
if you wanted to put the dependent jars in a sub-directory (people sometimes
put them under target, so they don't litter the main directory)

>
> > alternatively look at
> > http://www.ops4j.org/projects/pax/construct - you can
> > use these scripts to create
> > plug-in projects (uses Maven archetypes underneath) and the generated
> > projects have built-in support
> > for Eclipse/PDE - just uncomment the "ide-support" execution in the
> > top-level POM to update the PDE
> > project information automatically on each build, or use "mvn install
> > pax:eclipse" (it's like eclipse:eclipse
> > but has better OSGi support)
> >
> >   http://www.jroller.com/habuma/entry/pax_construct_from_zero_to
>
> Thanks, but I'm getting to know Felix better, and I'm already very glad for
> what I'm getting here!  :-)
> So, if I can do it with Felix (and Maven's Eclipse plugin), I will.
>

well that project also uses the bundleplugin ;) it basically generates POMs
and sample source code with useful defaults. I originally designed it to
help
save time writing OSGi tutorials, but others now use it to develop plug-ins

>
> > also have a look at the Tycho project, which might be a
> > better fit if you're
> > primarily working in Eclipse:
> >
> >
> > http://www.sonatype.com/people/2008/11/building-eclipse-plugin
> s-with-maven-tycho/<http://www.sonatype.com/people/2008/11/building-eclipse-plugin%0As-with-maven-tycho/>
> >   http://docs.codehaus.org/display/M2ECLIPSE/Tycho+user+docs
> >
>
> Thanks, Tycho looks promising for the future, but right now it looks like
> overkill for what I'm trying to do.
>
> Best regards,
> Eric
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

-- 
Cheers, Stuart

Reply via email to