felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart McCulloch <mccu...@gmail.com>
Subject Re: Hot to configure Maven Bundle plug-in for a mixture of OSGi and non OSGi dependencies
Date Mon, 17 Oct 2011 16:18:57 GMT
On 17 Oct 2011, at 17:01, Barbara Rosi-Schwartz wrote:

> I mean that I don't see the actual "third party" dependencies being embedded in the foo-bar.jar
file. The manifest appears to be correct.

If you want to see the instructions sent to bnd and the results passed back you can use "mvn
-X install" ... pipe the output to a file and search for BND. That should show whether the
processed Include-Resource instruction sent to bnd has those "third party" dependencies (feel
free to paste the bnd log into a reply if you want this checked). BTW, are you just excluding
a single artifact from being embedded or several? Could you paste your bnd instructions into
an email?

Otherwise consider attaching a test project to an issue on JIRA... if I use the "!foo-baz;scope=compile|runtime"
form I see the expected results in the manifest and jar file.

> -----Original Message-----
> From: Stuart McCulloch [mailto:mcculls@gmail.com] 
> Sent: 17 October 2011 16:51
> To: users@felix.apache.org
> Subject: Re: Hot to configure Maven Bundle plug-in for a mixture of OSGi and non OSGi
dependencies
> 
> On 17 Oct 2011, at 16:46, Barbara Rosi-Schwartz wrote:
> 
>> Hi Stuart, when I run the Maven Bundle plug-in with your suggested modification,
I do not see the embedded dependencies in the generated jar. Is there another trick to it?
;-)
> 
> Do you mean you don't see any embedded dependency, or that it correctly excludes the
foo-baz dependency?
> 
> I got the expected results locally using <Embed-Dependency>!foo-baz;scope=compile|runtime</Embed-Dependency>
and bundleplugin 2.3.5
> 
>> Thanks!
>> B.
>> 
>> -----Original Message-----
>> From: Stuart McCulloch [mailto:mcculls@gmail.com] 
>> Sent: 17 October 2011 12:55
>> To: users@felix.apache.org
>> Subject: Re: Hot to configure Maven Bundle plug-in for a mixture of OSGi and non
OSGi dependencies
>> 
>> On 17 Oct 2011, at 10:03, Barbara Rosi-Schwartz wrote:
>> 
>>> Hello.
>>> 
>>> I am using the Maven Bundle plug-in to OSGi-ify dependencies that we have on
another team's jars. These jars in turn have their own dependencies, some of which I have
already OSGi-ified, whereas others are third parties ones which I would just like to embed
in the generated bundles.
>>> 
>>> Let's assume that the jar I want to OSGi-ify is artefact foo-bar and that it
contains a bunch of third party dependencies + a dependency on artefact foo-baz, which I have
already OSGi-ified.
>>> 
>>> To this aim I configure my Maven Bundle plug-in as follows:
>>> 
>>> <configuration>
>>> <instructions>
>>>  <Export-Package>com.foo.bar.*</Export-Package>
>>>  <Bundle-Version>${parent.version}</Bundle-Version>
>>>  <Import-Package>com.foo.baz.client</Import-Package>
>>>  <Embed-Dependency>!foo-baz,*;scope=compile|runtime</Embed-Dependency>
>>> </instructions>
>>> </configuration>
>>> 
>>> The generated com.foo.bar's MANIFEST.MF does contain the expected Import-Package
clause, but it also contains foo-baz.jar in the Bundle-ClassPath clause, which is not what
I want. I have tried several permutation of the <Embed-Dependency> specification, but
to no avail.
>>> 
>>> How do I correctly specify the instructions to achieve my goal?
>> 
>> Hi B,
>> 
>> At the moment the Embed-Dependency clauses are processed independently when they're
mapped to bnd instructions (Include-Resource and Bundle-ClassPath).
>> 
>> So "!foo-baz, *;scope=compile|runtime" is actually processed as:
>> 
>>  !foo-baz                                  -->        embed any dependency whose
artifactId is not foo-bar
>> 
>>  *;scope=compile|runtime        -->        embed any compile/runtime scope dependency
>> 
>> Unfortunately this is different to how bnd processes negative Import-Package clauses,
which I agree is confusing - if you raise an issue for this at https://issues.apache.org/jira/browse/FELIX/component/12311143
I'll look into fixing this. Note that if you just use positive clauses then you won't encounter
this problem.
>> 
>> Meanwhile, as a workaround you can use:
>> 
>>  <Embed-Dependency>!foo-baz;scope=compile|runtime</Embed-Dependency>
>> 
>> which because it's one clause will achieve the desired result.
>> 
>> You can't easily extend this to exclude more than one artifactId, but in that case
you could perhaps deploy your OSGi and non-OSGi artifacts under different groups and use the
groupId to selectively embed only non-OSGi artifacts:
>> 
>>  <Embed-Dependency>groupId=!foo-osgi;scope=compile|runtime</Embed-Dependency>
>> 
>> Or as Neil suggested, you could look into converting those dependencies into individual
OSGi bundles.
>> 
>> --
>> Cheers, Stuart
>> 
>>> TIA,
>>> B.
>>> 
>>> BARBARA ROSI-SCHWARTZ
>>> Senior Developer
>>> 
>>> IG Group|Cannon Bridge House
>>> 25 Dowgate Hill|London|EC4R ZYA
>>> 
>>> t: +44(0)20 7573 0208 (Direct)
>>> t: +44(0)20 7896 0011 (Switchboard)
>>> w: www.iggroup.com
>>> 
>>> 
>>> ________________________________
>>> The information contained in this email is strictly confidential and for the
use of the addressee only, unless otherwise indicated. If you are not the intended recipient,
please do not read, copy, use or disclose to others this message or any attachment. Please
also notify the sender by replying to this email or by telephone (+44 (0)20 7896 0011) and
then delete the email and any copies of it. Opinions, conclusions (etc) that do not relate
to the official business of this company shall be understood as neither given nor endorsed
by it. IG Group Holdings plc is a company registered in England and Wales under number 01190902.
VAT registration number 761 2978 07. Registered Office: Cannon Bridge House, 25 Dowgate Hill,
London EC4R 2YA. Authorised and regulated by the Financial Services Authority. FSA Register
number 114059.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


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


Mime
View raw message