You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Steve Schwartz <sc...@alum.mit.edu> on 2009/04/22 19:39:30 UTC

Re: maven-bundle-plugin embed-dependency for test scope

Is it possible for "provided" dependencies to be passed as well?

I am creating an OSGi bundle, based on an existing jar from a separate Maven
project.  The bundle will wrap the jar, instantiating selected classes as
Spring beans.  The jar is traditionally deployed in a web container, with
some of its dependencies provided in a separate directory.  I want to have
all of its dependencies (compile | provided | runtime) embedded in the
bundle.  

As a workaround, I've copied the jar's scope-provided dependencies into the
bundle's pom.xml.  It denormalizes things a little.  Is there a way to make
BND see "provided" transitive dependencies?

--Steve



Will Horn wrote:
> 
> Hi,
> 
> I see this clear message at the top of
> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html:
> 
> NOTE: only compile, runtime and system scoped dependencies are passed to
> BND. Provided and test dependencies are not included in the classpath seen
> by BND.
> 
> [It actually discusses test scoped dependencies, not provided.]
> 
> 

-- 
View this message in context: http://www.nabble.com/maven-bundle-plugin-embed-dependency-for-test-scope-tp19653799p23175780.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: maven-bundle-plugin embed-dependency for test scope

Posted by Stuart McCulloch <mc...@gmail.com>.
2009/4/23 Steve Schwartz <sc...@alum.mit.edu>

>
> Is it possible for "provided" dependencies to be passed as well?
>

the 2.0.0 bundleplugin can now embed provided dependencies
(basically it can see anything that the Maven resolver can see)


> I am creating an OSGi bundle, based on an existing jar from a separate
> Maven
> project.  The bundle will wrap the jar, instantiating selected classes as
> Spring beans.  The jar is traditionally deployed in a web container, with
> some of its dependencies provided in a separate directory.  I want to have
> all of its dependencies (compile | provided | runtime) embedded in the
> bundle.
>
> As a workaround, I've copied the jar's scope-provided dependencies into the
> bundle's pom.xml.  It denormalizes things a little.  Is there a way to make
> BND see "provided" transitive dependencies?
>

transitive provided dependencies are a bit tricky because the Maven resolver
doesn't consider provided dependencies as transitive - we'd have to use our
own resolution process, which might not pick the same versions in the case
of a dependency conflict... you might also end up pulling in much more than
you bargained for (especially if you wanted optional dependencies too)

this would basically create a "mega-bundle" which would work in OSGi but
wouldn't be very modular - far better to process each major dependency as
a separate bundle then compose them together in the final application

FYI, I have some tools that can process the dependency graph and create
Maven poms to turn them into bundles:

   http://www.ops4j.org/projects/pax/construct/

you can use 'pax-wrap' to turn each dependency into a separate project:

   pax-create-project -g examples -a hibernate -v 3.1
   cd hibernate
   pax-wrap-jar -g org.hibernate -a hibernate -v 3.1 -- -DwrapTransitive

It's not perfect, as you may need to tweak the generated poms when
there's a cycle in the graph (which happens with hibernate) or there's
an artifact that you have to download from Sun, like certain specs,
but you might find it useful.

Craig Walls has a good intro to these tools:

  http://www.jroller.com/habuma/entry/pax_construct_from_zero_to

HTH

--Steve
>
> Will Horn wrote:
> >
> > Hi,
> >
> > I see this clear message at the top of
> > http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html:
> >
> > NOTE: only compile, runtime and system scoped dependencies are passed to
> > BND. Provided and test dependencies are not included in the classpath
> seen
> > by BND.
> >
> > [It actually discusses test scoped dependencies, not provided.]
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/maven-bundle-plugin-embed-dependency-for-test-scope-tp19653799p23175780.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart