You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by John Bäckstrand <so...@gmail.com> on 2010/12/27 21:25:04 UTC

Easily embed dependency all transitive with maven-bundle-plugin

Is there an easy way when using the maven-bundle-plugin to include the
transitive dependencies of a specific dependency?

For example I want to include htmlunit since I cannot find it in a bundle
form. But I also would like all its transitive dependencies. For this it
seems I have to specify all the packages in Embed-Dependency manually,
unless I use "*" which I do not want, since my other dependencies are
bundles and I deploy them manually in karaf.



-- 
John Bäckstrand

Re: Easily embed dependency all transitive with maven-bundle-plugin

Posted by Mike Van <mv...@comcast.net>.
John,

In similar situations, I've used the maven-bundle-plugin to "shade" a .jar file and it's dependencies into a new bundle. Then, you simply include the new shaded bundle as a dependency, deploying the new bundle separately into karaf.  This is very straightforward and  can solve your issue in a very OSGi friendly manner.  For examples of how this is done, take a look at how Apache Tika and ServiceMix deploy. 

Please let me know if this helps!

v/r,

Karafman

Sent from my Swwet-Axx Frakking Itouch

On Dec 27, 2010, at 5:21 PM, John Bäckstrand <so...@gmail.com> wrote:

> Just a note: I see that htmlunit is actually in springsource EBR:
> http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.gargoylesoftware.htmlunit&version=2.6.0
> 
> 
> I can't see the filters being able to easily select a tree of dependencies
> so I will conclude there is no "easy" way of doing what I want.
> 
> On Mon, Dec 27, 2010 at 23:12, Stuart McCulloch <mc...@gmail.com> wrote:
> 
>> 2010/12/27 John Bäckstrand <so...@gmail.com>
>> 
>>> From my testing that alone does not work.
>>> 
>> 
>> the embedding syntax is described here:
>> 
>> 
>> 
>> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html#ApacheFelixMavenBundlePlugin%28BND%29-Embeddingdependencies
>> 
>> 
>>> I had to change
>>> 
>>> 
>>> 
>> <Embed-Dependency>htmlunit;scope=runtime|compile;optional=false</Embed-Dependency>
>>> 
>> 
>> ^ this says "embed all non-optional compile and runtime dependencies which
>> have an artifactId of htmlunit"
>> so even with Embed-Transitive set to true you'd only be embedding htmlunit
>> and not all of its dependencies
>> 
>> 
>>> to
>>> 
>>> 
>> <Embed-Dependency>*;scope=runtime|compile;optional=false</Embed-Dependency>
>>> 
>>> for transitive dependendencies to embed.
>> 
>> 
>> which is expected, because this Embed-Dependency clause widens the search
>> to
>> include all dependencies
>> 
>> the link above shows examples of excluding/including particular
>> dependencies
>> if you don't want everything
>> 
>> 
>>> On Mon, Dec 27, 2010 at 22:24, Per-Erik Svensson <
>>> pererik.svensson@gmail.com
>>>> wrote:
>>> 
>>>> I believe
>>>> 
>>>> <Embed-Transitive>true</Embed-Transitive>
>>>> 
>>>> should work. Sadly, I'm not at work so I can't check how, exactly, I
>> did
>>>> it.
>>>> But the answer is, yes, it is possible to embed the transitive
>>>> dependencies.
>>>> Regarding the wild-card,
>>>> 
>> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.htmlhas
>>>> a
>>>> (somewhat) good description about how to add dependencies that match
>>>> specific patterns/criteria.
>>>> 
>>>> Just scroll down to the section "The following features are only
>>> available
>>>> from version 1.2.0 onwards" with the subsection "Embedding
>> dependencies".
>>>> 
>>>> Hope that helps!
>>>> 
>>>> /Per-Erik Svensson
>>>> 
>>>> 2010/12/27 John Bäckstrand <so...@gmail.com>
>>>> 
>>>>> Is there an easy way when using the maven-bundle-plugin to include
>> the
>>>>> transitive dependencies of a specific dependency?
>>>>> 
>>>>> For example I want to include htmlunit since I cannot find it in a
>>> bundle
>>>>> form. But I also would like all its transitive dependencies. For this
>>> it
>>>>> seems I have to specify all the packages in Embed-Dependency
>> manually,
>>>>> unless I use "*" which I do not want, since my other dependencies are
>>>>> bundles and I deploy them manually in karaf.
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> John Bäckstrand
>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> John Bäckstrand
>>> 
>> 
> 
> 
> 
> -- 
> John Bäckstrand

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


Re: Easily embed dependency all transitive with maven-bundle-plugin

Posted by John Bäckstrand <so...@gmail.com>.
Just a note: I see that htmlunit is actually in springsource EBR:
http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.gargoylesoftware.htmlunit&version=2.6.0


I can't see the filters being able to easily select a tree of dependencies
so I will conclude there is no "easy" way of doing what I want.

On Mon, Dec 27, 2010 at 23:12, Stuart McCulloch <mc...@gmail.com> wrote:

> 2010/12/27 John Bäckstrand <so...@gmail.com>
>
> > From my testing that alone does not work.
> >
>
> the embedding syntax is described here:
>
>
>
> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html#ApacheFelixMavenBundlePlugin%28BND%29-Embeddingdependencies
>
>
> > I had to change
> >
> >
> >
> <Embed-Dependency>htmlunit;scope=runtime|compile;optional=false</Embed-Dependency>
> >
>
> ^ this says "embed all non-optional compile and runtime dependencies which
> have an artifactId of htmlunit"
> so even with Embed-Transitive set to true you'd only be embedding htmlunit
> and not all of its dependencies
>
>
> > to
> >
> >
> <Embed-Dependency>*;scope=runtime|compile;optional=false</Embed-Dependency>
> >
> > for transitive dependendencies to embed.
>
>
> which is expected, because this Embed-Dependency clause widens the search
> to
> include all dependencies
>
> the link above shows examples of excluding/including particular
> dependencies
> if you don't want everything
>
>
> > On Mon, Dec 27, 2010 at 22:24, Per-Erik Svensson <
> > pererik.svensson@gmail.com
> > > wrote:
> >
> > > I believe
> > >
> > > <Embed-Transitive>true</Embed-Transitive>
> > >
> > > should work. Sadly, I'm not at work so I can't check how, exactly, I
> did
> > > it.
> > > But the answer is, yes, it is possible to embed the transitive
> > > dependencies.
> > > Regarding the wild-card,
> > >
> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.htmlhas
> > > a
> > > (somewhat) good description about how to add dependencies that match
> > > specific patterns/criteria.
> > >
> > > Just scroll down to the section "The following features are only
> > available
> > > from version 1.2.0 onwards" with the subsection "Embedding
> dependencies".
> > >
> > > Hope that helps!
> > >
> > > /Per-Erik Svensson
> > >
> > > 2010/12/27 John Bäckstrand <so...@gmail.com>
> > >
> > > > Is there an easy way when using the maven-bundle-plugin to include
> the
> > > > transitive dependencies of a specific dependency?
> > > >
> > > > For example I want to include htmlunit since I cannot find it in a
> > bundle
> > > > form. But I also would like all its transitive dependencies. For this
> > it
> > > > seems I have to specify all the packages in Embed-Dependency
> manually,
> > > > unless I use "*" which I do not want, since my other dependencies are
> > > > bundles and I deploy them manually in karaf.
> > > >
> > > >
> > > >
> > > > --
> > > > John Bäckstrand
> > > >
> > >
> >
> >
> >
> > --
> > John Bäckstrand
> >
>



-- 
John Bäckstrand

Re: Easily embed dependency all transitive with maven-bundle-plugin

Posted by Stuart McCulloch <mc...@gmail.com>.
2010/12/27 John Bäckstrand <so...@gmail.com>

> From my testing that alone does not work.
>

the embedding syntax is described here:


http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html#ApacheFelixMavenBundlePlugin%28BND%29-Embeddingdependencies


> I had to change
>
>
> <Embed-Dependency>htmlunit;scope=runtime|compile;optional=false</Embed-Dependency>
>

^ this says "embed all non-optional compile and runtime dependencies which
have an artifactId of htmlunit"
so even with Embed-Transitive set to true you'd only be embedding htmlunit
and not all of its dependencies


> to
>
> <Embed-Dependency>*;scope=runtime|compile;optional=false</Embed-Dependency>
>
> for transitive dependendencies to embed.


which is expected, because this Embed-Dependency clause widens the search to
include all dependencies

the link above shows examples of excluding/including particular dependencies
if you don't want everything


> On Mon, Dec 27, 2010 at 22:24, Per-Erik Svensson <
> pererik.svensson@gmail.com
> > wrote:
>
> > I believe
> >
> > <Embed-Transitive>true</Embed-Transitive>
> >
> > should work. Sadly, I'm not at work so I can't check how, exactly, I did
> > it.
> > But the answer is, yes, it is possible to embed the transitive
> > dependencies.
> > Regarding the wild-card,
> > http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.htmlhas
> > a
> > (somewhat) good description about how to add dependencies that match
> > specific patterns/criteria.
> >
> > Just scroll down to the section "The following features are only
> available
> > from version 1.2.0 onwards" with the subsection "Embedding dependencies".
> >
> > Hope that helps!
> >
> > /Per-Erik Svensson
> >
> > 2010/12/27 John Bäckstrand <so...@gmail.com>
> >
> > > Is there an easy way when using the maven-bundle-plugin to include the
> > > transitive dependencies of a specific dependency?
> > >
> > > For example I want to include htmlunit since I cannot find it in a
> bundle
> > > form. But I also would like all its transitive dependencies. For this
> it
> > > seems I have to specify all the packages in Embed-Dependency manually,
> > > unless I use "*" which I do not want, since my other dependencies are
> > > bundles and I deploy them manually in karaf.
> > >
> > >
> > >
> > > --
> > > John Bäckstrand
> > >
> >
>
>
>
> --
> John Bäckstrand
>

Re: Easily embed dependency all transitive with maven-bundle-plugin

Posted by John Bäckstrand <so...@gmail.com>.
>From my testing that alone does not work.

I had to change

<Embed-Dependency>htmlunit;scope=runtime|compile;optional=false</Embed-Dependency>

to

<Embed-Dependency>*;scope=runtime|compile;optional=false</Embed-Dependency>

for transitive dependendencies to embed.


On Mon, Dec 27, 2010 at 22:24, Per-Erik Svensson <pererik.svensson@gmail.com
> wrote:

> I believe
>
> <Embed-Transitive>true</Embed-Transitive>
>
> should work. Sadly, I'm not at work so I can't check how, exactly, I did
> it.
> But the answer is, yes, it is possible to embed the transitive
> dependencies.
> Regarding the wild-card,
> http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html has
> a
> (somewhat) good description about how to add dependencies that match
> specific patterns/criteria.
>
> Just scroll down to the section "The following features are only available
> from version 1.2.0 onwards" with the subsection "Embedding dependencies".
>
> Hope that helps!
>
> /Per-Erik Svensson
>
> 2010/12/27 John Bäckstrand <so...@gmail.com>
>
> > Is there an easy way when using the maven-bundle-plugin to include the
> > transitive dependencies of a specific dependency?
> >
> > For example I want to include htmlunit since I cannot find it in a bundle
> > form. But I also would like all its transitive dependencies. For this it
> > seems I have to specify all the packages in Embed-Dependency manually,
> > unless I use "*" which I do not want, since my other dependencies are
> > bundles and I deploy them manually in karaf.
> >
> >
> >
> > --
> > John Bäckstrand
> >
>



-- 
John Bäckstrand

Re: Easily embed dependency all transitive with maven-bundle-plugin

Posted by Per-Erik Svensson <pe...@gmail.com>.
I believe

<Embed-Transitive>true</Embed-Transitive>

should work. Sadly, I'm not at work so I can't check how, exactly, I did it.
But the answer is, yes, it is possible to embed the transitive dependencies.
Regarding the wild-card,
http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html has a
(somewhat) good description about how to add dependencies that match
specific patterns/criteria.

Just scroll down to the section "The following features are only available
from version 1.2.0 onwards" with the subsection "Embedding dependencies".

Hope that helps!

/Per-Erik Svensson

2010/12/27 John Bäckstrand <so...@gmail.com>

> Is there an easy way when using the maven-bundle-plugin to include the
> transitive dependencies of a specific dependency?
>
> For example I want to include htmlunit since I cannot find it in a bundle
> form. But I also would like all its transitive dependencies. For this it
> seems I have to specify all the packages in Embed-Dependency manually,
> unless I use "*" which I do not want, since my other dependencies are
> bundles and I deploy them manually in karaf.
>
>
>
> --
> John Bäckstrand
>