You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Sebastian Gomez <sa...@gmail.com> on 2008/12/24 12:56:01 UTC

Strange Issue with Maven Bundle Plugin

Hi everyone.
I'm developing a project that uses both Sling and ServiceMix. To compile the
whole project I have a unique POM with the references to all the modules of
the project. I've noticed a strange behaviour when the order of the modules
implies compiling a bundle before a service-unit: I don't know why but it
makes the service-unit get installed in my repo as a .jbi-service-unit
instead of as a .jar. It looks like using the maven-bundle-plugin affects
the preceding compilations. To me it doesn't make much sense, but maybe it
has an explanation. Any ideas?

Sorry for bothering both mailing lists, I wasn't sure which one should be
addressed.

Sebastian Gomez.

PS: I've done a little test to prove this by getting servicemix's
loan-broker-bpel example and modifying the loan-broker-bean-su to be
packaged as a bundle. Doing this makes the compilation of the loan-broker-sa
get an error for not being able to find the other 3 service units. If you
want me to attach it just tell me.

Re: Strange Issue with Maven Bundle Plugin

Posted by Stuart McCulloch <mc...@gmail.com>.
2008/12/24 Sebastian Gomez <sa...@gmail.com>

> Hi everyone.
> I'm developing a project that uses both Sling and ServiceMix. To compile
> the
> whole project I have a unique POM with the references to all the modules of
> the project. I've noticed a strange behaviour when the order of the modules
> implies compiling a bundle before a service-unit: I don't know why but it
> makes the service-unit get installed in my repo as a .jbi-service-unit
> instead of as a .jar. It looks like using the maven-bundle-plugin affects
> the preceding compilations. To me it doesn't make much sense, but maybe it
> has an explanation. Any ideas?


there is a long-standing bug in Maven where an artifact can be installed in
the local
repository with the wrong extension - this typically happens when a plugin
defines
its own packaging with one name, but then uses another name for the
extension.

for example, the maven-bundle-plugin defines the "bundle" packaging but uses
the
"jar" extension for the final artifact - some projects have seen artifacts
installed as
"foo.bundle" instead of "foo.jar" - this only happens with certain project
structures
and depends on whether you're using other plugins in the same phase, as well
as
whether you build from the project root or the individual project.

[ see: http://jira.codehaus.org/browse/MNG-2426 and other related issues ]

in the maven-bundle-plugin we work round this Maven bug by making sure the
final
artifact has the correct extension (".jar") before installing it in the
local repository.

because Maven tries to isolate plugins, I doubt that your problem is being
caused
by code in the maven-bundle-plugin - it's more likely that you happen to be
hitting
this core Maven bug, and it just happens to be triggered when you have the
bundle
plugin in your build (but other combinations of plugins could trigger it)

you could either upgrade to the latest Maven release to see if this fixes
your issue,
or alternatively you could ask the "jbi-service-unit" plugin to add a
workaround like
the one in the maven-bundle-plugin (just look in the BundlePlugin.java file,
the line
should be tagged with a comment referencing "MNG-1682")

HTH


> Sorry for bothering both mailing lists, I wasn't sure which one should be
> addressed.
>
> Sebastian Gomez.
>
> PS: I've done a little test to prove this by getting servicemix's
> loan-broker-bpel example and modifying the loan-broker-bean-su to be
> packaged as a bundle. Doing this makes the compilation of the
> loan-broker-sa
> get an error for not being able to find the other 3 service units. If you
> want me to attach it just tell me.
>



-- 
Cheers, Stuart

Re: Strange Issue with Maven Bundle Plugin

Posted by Sebastian Gomez <sa...@gmail.com>.
Hi Gert.
I've tried using 3.2.3 and it still doesn't work, but 4.0 does, so problem
solved!

Thanks a lot to both of you for your help.

Best regards,

Sebastian Gomez.

On Mon, Dec 29, 2008 at 10:45 AM, Gert Vanthienen <gert.vanthienen@skynet.be
> wrote:

> Sebastian,
>
> If you upgrade your Maven JBI plugin to version 3.2.3 or above, it includes
> the fix Stuart mentions in his post. (Cfr.
> https://issues.apache.org/activemq/browse/SMX4-64)
>
> Regards,
>
> Gert
>
> Sebastian Gomez wrote:
>
>> Hi.
>>
>> Stuart, I guess it must be what you say. I'll look into it and update with
>> my results.
>>
>> Gert, I'm using SMX 3, so I can't convert my SUs into an OSGI bundle. I'm
>> using the 3.2.2 jbi plugin. Do you think upgrading to a newer version will
>> help? BTW, how can I control the loading order of the plugins? Does it
>> depend on the order they are declared in the pom? Or are they loaded when
>> they are first used? I can declare them in the root pom, but I've tried
>> changing their order and I still get the same problem.
>>
>> On Mon, Dec 29, 2008 at 8:23 AM, Gert Vanthienen
>> <ge...@skynet.be>wrote:
>>
>>
>>
>>> Sebastian,
>>>
>>> Are you working on a project for ServiceMix 3 or ServiceMix 4?  The
>>> latter
>>> is OSGi based, so you could just develop your SU as OSGi bundles as well.
>>> What version of the Maven JBI plugin are you using?  Could you try
>>> defining
>>> both plugins in the same file (the root pom probably) so you can control
>>> the
>>> order in which they are loaded more easily?
>>>
>>> Regards,
>>>
>>> Gert
>>>
>>>
>>> Sebastian Gomez wrote:
>>>
>>>
>>>
>>>> Hi everyone.
>>>> I'm developing a project that uses both Sling and ServiceMix. To compile
>>>> the
>>>> whole project I have a unique POM with the references to all the modules
>>>> of
>>>> the project. I've noticed a strange behaviour when the order of the
>>>> modules
>>>> implies compiling a bundle before a service-unit: I don't know why but
>>>> it
>>>> makes the service-unit get installed in my repo as a .jbi-service-unit
>>>> instead of as a .jar. It looks like using the maven-bundle-plugin
>>>> affects
>>>> the preceding compilations. To me it doesn't make much sense, but maybe
>>>> it
>>>> has an explanation. Any ideas?
>>>>
>>>> Sorry for bothering both mailing lists, I wasn't sure which one should
>>>> be
>>>> addressed.
>>>>
>>>> Sebastian Gomez.
>>>>
>>>> PS: I've done a little test to prove this by getting servicemix's
>>>> loan-broker-bpel example and modifying the loan-broker-bean-su to be
>>>> packaged as a bundle. Doing this makes the compilation of the
>>>> loan-broker-sa
>>>> get an error for not being able to find the other 3 service units. If
>>>> you
>>>> want me to attach it just tell me.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>

Re: Strange Issue with Maven Bundle Plugin

Posted by Gert Vanthienen <ge...@skynet.be>.
Sebastian,

If you upgrade your Maven JBI plugin to version 3.2.3 or above, it 
includes the fix Stuart mentions in his post. (Cfr. 
https://issues.apache.org/activemq/browse/SMX4-64)

Regards,

Gert

Sebastian Gomez wrote:
> Hi.
> Stuart, I guess it must be what you say. I'll look into it and update with
> my results.
>
> Gert, I'm using SMX 3, so I can't convert my SUs into an OSGI bundle. I'm
> using the 3.2.2 jbi plugin. Do you think upgrading to a newer version will
> help? BTW, how can I control the loading order of the plugins? Does it
> depend on the order they are declared in the pom? Or are they loaded when
> they are first used? I can declare them in the root pom, but I've tried
> changing their order and I still get the same problem.
>
> On Mon, Dec 29, 2008 at 8:23 AM, Gert Vanthienen
> <ge...@skynet.be>wrote:
>
>   
>> Sebastian,
>>
>> Are you working on a project for ServiceMix 3 or ServiceMix 4?  The latter
>> is OSGi based, so you could just develop your SU as OSGi bundles as well.
>> What version of the Maven JBI plugin are you using?  Could you try defining
>> both plugins in the same file (the root pom probably) so you can control the
>> order in which they are loaded more easily?
>>
>> Regards,
>>
>> Gert
>>
>>
>> Sebastian Gomez wrote:
>>
>>     
>>> Hi everyone.
>>> I'm developing a project that uses both Sling and ServiceMix. To compile
>>> the
>>> whole project I have a unique POM with the references to all the modules
>>> of
>>> the project. I've noticed a strange behaviour when the order of the
>>> modules
>>> implies compiling a bundle before a service-unit: I don't know why but it
>>> makes the service-unit get installed in my repo as a .jbi-service-unit
>>> instead of as a .jar. It looks like using the maven-bundle-plugin affects
>>> the preceding compilations. To me it doesn't make much sense, but maybe it
>>> has an explanation. Any ideas?
>>>
>>> Sorry for bothering both mailing lists, I wasn't sure which one should be
>>> addressed.
>>>
>>> Sebastian Gomez.
>>>
>>> PS: I've done a little test to prove this by getting servicemix's
>>> loan-broker-bpel example and modifying the loan-broker-bean-su to be
>>> packaged as a bundle. Doing this makes the compilation of the
>>> loan-broker-sa
>>> get an error for not being able to find the other 3 service units. If you
>>> want me to attach it just tell me.
>>>
>>>
>>>
>>>       
>>     
>
>   


Re: Strange Issue with Maven Bundle Plugin

Posted by Sebastian Gomez <sa...@gmail.com>.
Hi.
Stuart, I guess it must be what you say. I'll look into it and update with
my results.

Gert, I'm using SMX 3, so I can't convert my SUs into an OSGI bundle. I'm
using the 3.2.2 jbi plugin. Do you think upgrading to a newer version will
help? BTW, how can I control the loading order of the plugins? Does it
depend on the order they are declared in the pom? Or are they loaded when
they are first used? I can declare them in the root pom, but I've tried
changing their order and I still get the same problem.

On Mon, Dec 29, 2008 at 8:23 AM, Gert Vanthienen
<ge...@skynet.be>wrote:

> Sebastian,
>
> Are you working on a project for ServiceMix 3 or ServiceMix 4?  The latter
> is OSGi based, so you could just develop your SU as OSGi bundles as well.
> What version of the Maven JBI plugin are you using?  Could you try defining
> both plugins in the same file (the root pom probably) so you can control the
> order in which they are loaded more easily?
>
> Regards,
>
> Gert
>
>
> Sebastian Gomez wrote:
>
>> Hi everyone.
>> I'm developing a project that uses both Sling and ServiceMix. To compile
>> the
>> whole project I have a unique POM with the references to all the modules
>> of
>> the project. I've noticed a strange behaviour when the order of the
>> modules
>> implies compiling a bundle before a service-unit: I don't know why but it
>> makes the service-unit get installed in my repo as a .jbi-service-unit
>> instead of as a .jar. It looks like using the maven-bundle-plugin affects
>> the preceding compilations. To me it doesn't make much sense, but maybe it
>> has an explanation. Any ideas?
>>
>> Sorry for bothering both mailing lists, I wasn't sure which one should be
>> addressed.
>>
>> Sebastian Gomez.
>>
>> PS: I've done a little test to prove this by getting servicemix's
>> loan-broker-bpel example and modifying the loan-broker-bean-su to be
>> packaged as a bundle. Doing this makes the compilation of the
>> loan-broker-sa
>> get an error for not being able to find the other 3 service units. If you
>> want me to attach it just tell me.
>>
>>
>>
>
>

Re: Strange Issue with Maven Bundle Plugin

Posted by Gert Vanthienen <ge...@skynet.be>.
Sebastian,

Are you working on a project for ServiceMix 3 or ServiceMix 4?  The 
latter is OSGi based, so you could just develop your SU as OSGi bundles 
as well.
What version of the Maven JBI plugin are you using?  Could you try 
defining both plugins in the same file (the root pom probably) so you 
can control the order in which they are loaded more easily?

Regards,

Gert

Sebastian Gomez wrote:
> Hi everyone.
> I'm developing a project that uses both Sling and ServiceMix. To compile the
> whole project I have a unique POM with the references to all the modules of
> the project. I've noticed a strange behaviour when the order of the modules
> implies compiling a bundle before a service-unit: I don't know why but it
> makes the service-unit get installed in my repo as a .jbi-service-unit
> instead of as a .jar. It looks like using the maven-bundle-plugin affects
> the preceding compilations. To me it doesn't make much sense, but maybe it
> has an explanation. Any ideas?
>
> Sorry for bothering both mailing lists, I wasn't sure which one should be
> addressed.
>
> Sebastian Gomez.
>
> PS: I've done a little test to prove this by getting servicemix's
> loan-broker-bpel example and modifying the loan-broker-bean-su to be
> packaged as a bundle. Doing this makes the compilation of the loan-broker-sa
> get an error for not being able to find the other 3 service units. If you
> want me to attach it just tell me.
>
>