You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by David Bosschaert <da...@gmail.com> on 2011/11/21 16:11:22 UTC

Maven bundle plugin split-package question

Hi all,

I as part of a refactoring a project is moving some classes from a
package org.acme.foo from bundle A to a separate bundle B.
Unfortunately its not possible to move all the classes to the separate
bundle so this introduces a split package. Both bundle A and bundle B
export package org.acme.foo.

Bundle A has a maven dependency on bundle B.
What happens at the moment with the Maven Bundle Plugin 2.3.4 (we
can't use 2.3.5 as it has a different bug) is that all the classes
from org.acme.foo that exist in bundle B are copied into the resulting
bundle A.

This should not happen. I tried a number of things to exclude the
classes from bundle B appearing in bundle A but none of them seem to
work. Anyone an idea how to prevent this?

BTW I'd rather not go into whether the project should or should not
split these packages. The project is planning to do a package refactor
in the next major release, but can't do this right now.

Thanks,

David

BTW I fabricated a test case for it in the split-package branch of
https://github.com/bosschaert/coderthoughts/tree/split-package/AsciiGraphicsService_MBP
in this (simplified) testcase the duplicate class is added to bundle
ascii-pics-api-bundle-mbp and should not (but does) appear in
ascii-pics-provider-bundle-mbp/

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


Re: Maven bundle plugin split-package question

Posted by David Bosschaert <da...@gmail.com>.
The package both exists in the current project as well as in it's sole
dependency, so I can't really change the order.

I've create https://issues.apache.org/jira/browse/FELIX-3238 which
contains the pom.xml that I'm using in my test setup.

Hiding the package from the jar using a directive on Export-Package is
not really an option because we don't want this .class file duplicated
across multiple bundles/jars.

Many thanks,

David

On 21 November 2011 16:35, Peter Kriens <pe...@aqute.biz> wrote:
> Did you try reversing the dependency order? Stuart gave you the right hint but if your rogue class is in the first bundle then you're done for.
>
> If the rogue stuff is in an exported class you can also just hide it in the Export-Package: statement with the OSGi exclude directive?
>
> Kind regards,
>
>        Peter Kriens
>
> On 21 nov. 2011, at 16:50, David Bosschaert wrote:
>
>> Hi Stuart,
>>
>> On 21 November 2011 15:38, Stuart McCulloch <mc...@gmail.com> wrote:
>>> On 21 Nov 2011, at 15:11, David Bosschaert wrote:
>>>>
>>>> What happens at the moment with the Maven Bundle Plugin 2.3.4 (we
>>>> can't use 2.3.5 as it has a different bug
>>>
>>> ^ have you reported that bug on JIRA?  If not then please do it soon otherwise it won't make it into the 2.3.6 release
>>
>> Yes, it's: https://issues.apache.org/jira/browse/FELIX-3058
>>
>>>> ) is that all the classes
>>>> from org.acme.foo that exist in bundle B are copied into the resulting
>>>> bundle A.
>>>>
>>>> This should not happen. I tried a number of things to exclude the
>>>> classes from bundle B appearing in bundle A but none of them seem to
>>>> work. Anyone an idea how to prevent this?
>>>
>>> Have you tried:
>>>
>>>   Export-Package: blah;-split-package:=first
>>>
>>> This tells BND to use the contents of the first definition of the "blah" package (which should be the one from the local "target/classes") instead of merging.
>>
>> Adding that doesn't help.
>>
>> I've updated my test setup at
>> https://github.com/bosschaert/coderthoughts (branch: split-package)
>> with the directive but the bundle generated in
>> ascii-pics-provider-bundle-mbp still contains
>> org.coderthoughts.asciipics.impl.RogueClass from the
>> ascii-pics-api-bundle-mbp bundle...
>>
>> Any further help much appreciated!
>>
>> David
>>
>> ---------------------------------------------------------------------
>> 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


Re: Maven bundle plugin split-package question

Posted by Peter Kriens <pe...@aqute.biz>.
Did you try reversing the dependency order? Stuart gave you the right hint but if your rogue class is in the first bundle then you're done for.

If the rogue stuff is in an exported class you can also just hide it in the Export-Package: statement with the OSGi exclude directive?

Kind regards,

	Peter Kriens

On 21 nov. 2011, at 16:50, David Bosschaert wrote:

> Hi Stuart,
> 
> On 21 November 2011 15:38, Stuart McCulloch <mc...@gmail.com> wrote:
>> On 21 Nov 2011, at 15:11, David Bosschaert wrote:
>>> 
>>> What happens at the moment with the Maven Bundle Plugin 2.3.4 (we
>>> can't use 2.3.5 as it has a different bug
>> 
>> ^ have you reported that bug on JIRA?  If not then please do it soon otherwise it won't make it into the 2.3.6 release
> 
> Yes, it's: https://issues.apache.org/jira/browse/FELIX-3058
> 
>>> ) is that all the classes
>>> from org.acme.foo that exist in bundle B are copied into the resulting
>>> bundle A.
>>> 
>>> This should not happen. I tried a number of things to exclude the
>>> classes from bundle B appearing in bundle A but none of them seem to
>>> work. Anyone an idea how to prevent this?
>> 
>> Have you tried:
>> 
>>   Export-Package: blah;-split-package:=first
>> 
>> This tells BND to use the contents of the first definition of the "blah" package (which should be the one from the local "target/classes") instead of merging.
> 
> Adding that doesn't help.
> 
> I've updated my test setup at
> https://github.com/bosschaert/coderthoughts (branch: split-package)
> with the directive but the bundle generated in
> ascii-pics-provider-bundle-mbp still contains
> org.coderthoughts.asciipics.impl.RogueClass from the
> ascii-pics-api-bundle-mbp bundle...
> 
> Any further help much appreciated!
> 
> David
> 
> ---------------------------------------------------------------------
> 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


Re: Maven bundle plugin split-package question

Posted by David Bosschaert <da...@gmail.com>.
Hi Stuart,

On 21 November 2011 15:38, Stuart McCulloch <mc...@gmail.com> wrote:
> On 21 Nov 2011, at 15:11, David Bosschaert wrote:
>>
>> What happens at the moment with the Maven Bundle Plugin 2.3.4 (we
>> can't use 2.3.5 as it has a different bug
>
> ^ have you reported that bug on JIRA?  If not then please do it soon otherwise it won't make it into the 2.3.6 release

Yes, it's: https://issues.apache.org/jira/browse/FELIX-3058

>> ) is that all the classes
>> from org.acme.foo that exist in bundle B are copied into the resulting
>> bundle A.
>>
>> This should not happen. I tried a number of things to exclude the
>> classes from bundle B appearing in bundle A but none of them seem to
>> work. Anyone an idea how to prevent this?
>
> Have you tried:
>
>   Export-Package: blah;-split-package:=first
>
> This tells BND to use the contents of the first definition of the "blah" package (which should be the one from the local "target/classes") instead of merging.

Adding that doesn't help.

I've updated my test setup at
https://github.com/bosschaert/coderthoughts (branch: split-package)
with the directive but the bundle generated in
ascii-pics-provider-bundle-mbp still contains
org.coderthoughts.asciipics.impl.RogueClass from the
ascii-pics-api-bundle-mbp bundle...

Any further help much appreciated!

David

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


Re: Maven bundle plugin split-package question

Posted by Stuart McCulloch <mc...@gmail.com>.
On 21 Nov 2011, at 15:11, David Bosschaert wrote:

> Hi all,
> 
> I as part of a refactoring a project is moving some classes from a
> package org.acme.foo from bundle A to a separate bundle B.
> Unfortunately its not possible to move all the classes to the separate
> bundle so this introduces a split package. Both bundle A and bundle B
> export package org.acme.foo.
> 
> Bundle A has a maven dependency on bundle B.
> What happens at the moment with the Maven Bundle Plugin 2.3.4 (we
> can't use 2.3.5 as it has a different bug

^ have you reported that bug on JIRA?  If not then please do it soon otherwise it won't make it into the 2.3.6 release

> ) is that all the classes
> from org.acme.foo that exist in bundle B are copied into the resulting
> bundle A.
> 
> This should not happen. I tried a number of things to exclude the
> classes from bundle B appearing in bundle A but none of them seem to
> work. Anyone an idea how to prevent this?

Have you tried:

   Export-Package: blah;-split-package:=first

This tells BND to use the contents of the first definition of the "blah" package (which should be the one from the local "target/classes") instead of merging.

> BTW I'd rather not go into whether the project should or should not
> split these packages. The project is planning to do a package refactor
> in the next major release, but can't do this right now.
> 
> Thanks,
> 
> David
> 
> BTW I fabricated a test case for it in the split-package branch of
> https://github.com/bosschaert/coderthoughts/tree/split-package/AsciiGraphicsService_MBP
> in this (simplified) testcase the duplicate class is added to bundle
> ascii-pics-api-bundle-mbp and should not (but does) appear in
> ascii-pics-provider-bundle-mbp/
> 
> ---------------------------------------------------------------------
> 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