You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Benoît Thiébault <th...@artenum.com> on 2012/10/03 14:43:32 UTC

Maven Bundle Plugin incompatible with SVN revision bundles

Hi everyone,

I don't know if this mailing list is the right place to post my question...

I am developing OSGi applications that are managed by Maven (and 
maven-bundle-plugin in particular) and I would like to provide the SVN 
revision number in the bundle MANIFEST.

There are two Maven plugins that I am aware of that provide this 
functionality. They are namely:
- maven-svn-revision-number-plugin, 
http://code.google.com/p/maven-svn-revision-number-plugin/
- buildnumber-maven-plugin, 
http://mojo.codehaus.org/buildnumber-maven-plugin/

While both of them work perfectly on standard <package>jar</package> 
Maven modules, they both fail with <package>bundle</package> Maven modules.

How do you do this in OSGi context? Are there other Maven plugins 
available that work well with BND? If this is a BND bug, can it be fixed?

I have asked questions on the subject here 
http://stackoverflow.com/questions/12604161/error-while-adding-svn-revision-in-jar-manifest-with-maven-and-maven-bundle-plug 
and there 
https://groups.google.com/forum/?fromgroups=#!topic/maven-svn-revision-number-plugin/yvHvn1tS_2M 
without success so far.

Kind regards,

Benoît

Re: Maven Bundle Plugin incompatible with SVN revision bundles

Posted by Benoît Thiébault <th...@artenum.com>.
It worked, thanks!

Le 04/10/2012 20:11, Allen Lau a écrit :
> I think if you specify <instructions combine.inherited="append"> in the
> child pom, it should work.
> Check http://maven.apache.org/pom.html#Inheritance for a detailed
> explanation.
>
> On Thu, Oct 4, 2012 at 12:22 AM, Benoît Thiébault <th...@artenum.com>wrote:
>
>> Thanks for your answer.
>>
>> That seems to be the problem: I mixed both plugins.
>>
>> The idea was to insert the build number in the manifest via the super pom
>> of my projects in order to avoid modifying all modules. Thus I inserted in
>> the Super POM:
>>
>> |<plugin>
>>      <groupId>org.apache.maven.**plugins</groupId>
>>      <artifactId>maven-jar-plugin</**artifactId>
>>      <version>2.1</version>
>>      <configuration>
>>          <archive>
>>              <manifest>
>>                  <**addDefaultImplementationEntrie**s>true</**
>> addDefaultImplementationEntrie**s>
>>              </manifest>
>>              <manifestEntries>
>>                  <Implementation-Build>${**buildNumber}</Implementation-**
>> Build>
>>              </manifestEntries>
>>          </archive>
>>       </configuration>
>> </plugin>|
>>
>> By inheritance, each bundle would have included the build number in its
>> manifest.
>>
>> If this does not work (mixing maven-bundle-plugin and maven-jar-plugin),
>> then I guess I have to change the POM of all my modules, because if in the
>> super POM I insert:
>>
>> <plugin>
>>      <groupId>org.apache.felix</**groupId>
>> <artifactId>maven-bundle-**plugin</artifactId>
>>      <configuration>
>>          <instructions>
>> <Implementation-Build>${**buildNumber}</Implementation-**Build>
>>          </instructions>
>>      </configuration>
>> </plugin>
>>
>> It will be overwritten by the bundle configuration of my modules.... Not
>> very handy. But is there another way?
>>
>> Kind regards
>>
>>
>> Le 04/10/2012 00:19, Allen Lau a écrit :
>>
>>> buildnumber-maven-plugin definitely works.  Use maven-jar-plugin or
>>> maven-bundle-plugin depending on your package type.  Don't mix them up.
>>> I
>>> would recommend that you use the "bundle" type and the maven-bundle-plugin
>>> for building OSGi apps.  Try turning on debug with mvn -X to see what's
>>> going on.
>>>
>>> On Wed, Oct 3, 2012 at 5:43 AM, Benoît Thiébault <thiebault@artenum.com
>>>> wrote:
>>>   Hi everyone,
>>>> I don't know if this mailing list is the right place to post my
>>>> question...
>>>>
>>>> I am developing OSGi applications that are managed by Maven (and
>>>> maven-bundle-plugin in particular) and I would like to provide the SVN
>>>> revision number in the bundle MANIFEST.
>>>>
>>>> There are two Maven plugins that I am aware of that provide this
>>>> functionality. They are namely:
>>>> - maven-svn-revision-number-****plugin, http://code.google.com/p/**
>>>> maven-svn-revision-number-****plugin/<http://code.google.**
>>>> com/p/maven-svn-revision-**number-plugin/<http://code.google.com/p/maven-svn-revision-number-plugin/>
>>>> - buildnumber-maven-plugin, http://mojo.codehaus.org/**
>>>> buildnumber-maven-plugin/<http**://mojo.codehaus.org/**
>>>> buildnumber-maven-plugin/<http://mojo.codehaus.org/buildnumber-maven-plugin/>
>>>>
>>>> While both of them work perfectly on standard <package>jar</package>
>>>> Maven
>>>> modules, they both fail with <package>bundle</package> Maven modules.
>>>>
>>>> How do you do this in OSGi context? Are there other Maven plugins
>>>> available that work well with BND? If this is a BND bug, can it be fixed?
>>>>
>>>> I have asked questions on the subject here http://stackoverflow.com/**
>>>> questions/12604161/error-****while-adding-svn-revision-in-****
>>>> jar-manifest-with-maven-and-****maven-bundle-plug<http://**
>>>> stackoverflow.com/questions/**12604161/error-while-adding-**
>>>> svn-revision-in-jar-manifest-**with-maven-and-maven-bundle-**plug<http://stackoverflow.com/questions/12604161/error-while-adding-svn-revision-in-jar-manifest-with-maven-and-maven-bundle-plug>>and
>>>> there
>>>> https://groups.google.com/****forum/?fromgroups=#!topic/**<https://groups.google.com/**forum/?fromgroups=#!topic/**>
>>>> maven-svn-revision-number-****plugin/yvHvn1tS_2M<https://**
>>>> groups.google.com/forum/?**fromgroups=#!topic/maven-svn-**
>>>> revision-number-plugin/**yvHvn1tS_2M<https://groups.google.com/forum/?fromgroups=#!topic/maven-svn-revision-number-plugin/yvHvn1tS_2M>>without
>>>> success so far.
>>>>
>>>> Kind regards,
>>>>
>>>> Benoît
>>>>
>>>>


-- 
Dr Benoît Thiébault
Project Manager

    Artenum Toulouse - Science & Groupware
    http://www.artenum.com

        Bâtiment Calfocenter
        10, rue Marguerite-Long
        31320 Castanet-Tolosan
        France
        Phone: +33 (0)5 82 95 19 00


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


Re: Maven Bundle Plugin incompatible with SVN revision bundles

Posted by Allen Lau <al...@gmail.com>.
I think if you specify <instructions combine.inherited="append"> in the
child pom, it should work.
Check http://maven.apache.org/pom.html#Inheritance for a detailed
explanation.

On Thu, Oct 4, 2012 at 12:22 AM, Benoît Thiébault <th...@artenum.com>wrote:

> Thanks for your answer.
>
> That seems to be the problem: I mixed both plugins.
>
> The idea was to insert the build number in the manifest via the super pom
> of my projects in order to avoid modifying all modules. Thus I inserted in
> the Super POM:
>
> |<plugin>
>     <groupId>org.apache.maven.**plugins</groupId>
>     <artifactId>maven-jar-plugin</**artifactId>
>     <version>2.1</version>
>     <configuration>
>         <archive>
>             <manifest>
>                 <**addDefaultImplementationEntrie**s>true</**
> addDefaultImplementationEntrie**s>
>             </manifest>
>             <manifestEntries>
>                 <Implementation-Build>${**buildNumber}</Implementation-**
> Build>
>             </manifestEntries>
>         </archive>
>      </configuration>
> </plugin>|
>
> By inheritance, each bundle would have included the build number in its
> manifest.
>
> If this does not work (mixing maven-bundle-plugin and maven-jar-plugin),
> then I guess I have to change the POM of all my modules, because if in the
> super POM I insert:
>
> <plugin>
>     <groupId>org.apache.felix</**groupId>
> <artifactId>maven-bundle-**plugin</artifactId>
>     <configuration>
>         <instructions>
> <Implementation-Build>${**buildNumber}</Implementation-**Build>
>         </instructions>
>     </configuration>
> </plugin>
>
> It will be overwritten by the bundle configuration of my modules.... Not
> very handy. But is there another way?
>
> Kind regards
>
>
> Le 04/10/2012 00:19, Allen Lau a écrit :
>
>> buildnumber-maven-plugin definitely works.  Use maven-jar-plugin or
>> maven-bundle-plugin depending on your package type.  Don't mix them up.
>> I
>> would recommend that you use the "bundle" type and the maven-bundle-plugin
>> for building OSGi apps.  Try turning on debug with mvn -X to see what's
>> going on.
>>
>> On Wed, Oct 3, 2012 at 5:43 AM, Benoît Thiébault <thiebault@artenum.com
>> >wrote:
>>
>>  Hi everyone,
>>>
>>> I don't know if this mailing list is the right place to post my
>>> question...
>>>
>>> I am developing OSGi applications that are managed by Maven (and
>>> maven-bundle-plugin in particular) and I would like to provide the SVN
>>> revision number in the bundle MANIFEST.
>>>
>>> There are two Maven plugins that I am aware of that provide this
>>> functionality. They are namely:
>>> - maven-svn-revision-number-****plugin, http://code.google.com/p/**
>>> maven-svn-revision-number-****plugin/<http://code.google.**
>>> com/p/maven-svn-revision-**number-plugin/<http://code.google.com/p/maven-svn-revision-number-plugin/>
>>> >
>>> - buildnumber-maven-plugin, http://mojo.codehaus.org/**
>>> buildnumber-maven-plugin/<http**://mojo.codehaus.org/**
>>> buildnumber-maven-plugin/<http://mojo.codehaus.org/buildnumber-maven-plugin/>
>>> >
>>>
>>>
>>> While both of them work perfectly on standard <package>jar</package>
>>> Maven
>>> modules, they both fail with <package>bundle</package> Maven modules.
>>>
>>> How do you do this in OSGi context? Are there other Maven plugins
>>> available that work well with BND? If this is a BND bug, can it be fixed?
>>>
>>> I have asked questions on the subject here http://stackoverflow.com/**
>>> questions/12604161/error-****while-adding-svn-revision-in-****
>>> jar-manifest-with-maven-and-****maven-bundle-plug<http://**
>>> stackoverflow.com/questions/**12604161/error-while-adding-**
>>> svn-revision-in-jar-manifest-**with-maven-and-maven-bundle-**plug<http://stackoverflow.com/questions/12604161/error-while-adding-svn-revision-in-jar-manifest-with-maven-and-maven-bundle-plug>>and
>>> there
>>> https://groups.google.com/****forum/?fromgroups=#!topic/**<https://groups.google.com/**forum/?fromgroups=#!topic/**>
>>> maven-svn-revision-number-****plugin/yvHvn1tS_2M<https://**
>>> groups.google.com/forum/?**fromgroups=#!topic/maven-svn-**
>>> revision-number-plugin/**yvHvn1tS_2M<https://groups.google.com/forum/?fromgroups=#!topic/maven-svn-revision-number-plugin/yvHvn1tS_2M>>without
>>> success so far.
>>>
>>> Kind regards,
>>>
>>> Benoît
>>>
>>>
>

Re: Maven Bundle Plugin incompatible with SVN revision bundles

Posted by Benoît Thiébault <th...@artenum.com>.
Thanks for your answer.

That seems to be the problem: I mixed both plugins.

The idea was to insert the build number in the manifest via the super 
pom of my projects in order to avoid modifying all modules. Thus I 
inserted in the Super POM:

|<plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-jar-plugin</artifactId>
     <version>2.1</version>
     <configuration>
         <archive>
             <manifest>
                 <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
             </manifest>
             <manifestEntries>
                 <Implementation-Build>${buildNumber}</Implementation-Build>
             </manifestEntries>
         </archive>
      </configuration>
</plugin>|

By inheritance, each bundle would have included the build number in its 
manifest.

If this does not work (mixing maven-bundle-plugin and maven-jar-plugin), 
then I guess I have to change the POM of all my modules, because if in 
the super POM I insert:

<plugin>
     <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
     <configuration>
         <instructions>
<Implementation-Build>${buildNumber}</Implementation-Build>
         </instructions>
     </configuration>
</plugin>

It will be overwritten by the bundle configuration of my modules.... Not 
very handy. But is there another way?

Kind regards


Le 04/10/2012 00:19, Allen Lau a écrit :
> buildnumber-maven-plugin definitely works.  Use maven-jar-plugin or
> maven-bundle-plugin depending on your package type.  Don't mix them up.   I
> would recommend that you use the "bundle" type and the maven-bundle-plugin
> for building OSGi apps.  Try turning on debug with mvn -X to see what's
> going on.
>
> On Wed, Oct 3, 2012 at 5:43 AM, Benoît Thiébault <th...@artenum.com>wrote:
>
>> Hi everyone,
>>
>> I don't know if this mailing list is the right place to post my question...
>>
>> I am developing OSGi applications that are managed by Maven (and
>> maven-bundle-plugin in particular) and I would like to provide the SVN
>> revision number in the bundle MANIFEST.
>>
>> There are two Maven plugins that I am aware of that provide this
>> functionality. They are namely:
>> - maven-svn-revision-number-**plugin, http://code.google.com/p/**
>> maven-svn-revision-number-**plugin/<http://code.google.com/p/maven-svn-revision-number-plugin/>
>> - buildnumber-maven-plugin, http://mojo.codehaus.org/**
>> buildnumber-maven-plugin/<http://mojo.codehaus.org/buildnumber-maven-plugin/>
>>
>> While both of them work perfectly on standard <package>jar</package> Maven
>> modules, they both fail with <package>bundle</package> Maven modules.
>>
>> How do you do this in OSGi context? Are there other Maven plugins
>> available that work well with BND? If this is a BND bug, can it be fixed?
>>
>> I have asked questions on the subject here http://stackoverflow.com/**
>> questions/12604161/error-**while-adding-svn-revision-in-**
>> jar-manifest-with-maven-and-**maven-bundle-plug<http://stackoverflow.com/questions/12604161/error-while-adding-svn-revision-in-jar-manifest-with-maven-and-maven-bundle-plug>and there
>> https://groups.google.com/**forum/?fromgroups=#!topic/**
>> maven-svn-revision-number-**plugin/yvHvn1tS_2M<https://groups.google.com/forum/?fromgroups=#!topic/maven-svn-revision-number-plugin/yvHvn1tS_2M>without success so far.
>>
>> Kind regards,
>>
>> Benoît
>>


Re: Maven Bundle Plugin incompatible with SVN revision bundles

Posted by Allen Lau <al...@gmail.com>.
buildnumber-maven-plugin definitely works.  Use maven-jar-plugin or
maven-bundle-plugin depending on your package type.  Don't mix them up.   I
would recommend that you use the "bundle" type and the maven-bundle-plugin
for building OSGi apps.  Try turning on debug with mvn -X to see what's
going on.

On Wed, Oct 3, 2012 at 5:43 AM, Benoît Thiébault <th...@artenum.com>wrote:

> Hi everyone,
>
> I don't know if this mailing list is the right place to post my question...
>
> I am developing OSGi applications that are managed by Maven (and
> maven-bundle-plugin in particular) and I would like to provide the SVN
> revision number in the bundle MANIFEST.
>
> There are two Maven plugins that I am aware of that provide this
> functionality. They are namely:
> - maven-svn-revision-number-**plugin, http://code.google.com/p/**
> maven-svn-revision-number-**plugin/<http://code.google.com/p/maven-svn-revision-number-plugin/>
> - buildnumber-maven-plugin, http://mojo.codehaus.org/**
> buildnumber-maven-plugin/<http://mojo.codehaus.org/buildnumber-maven-plugin/>
>
> While both of them work perfectly on standard <package>jar</package> Maven
> modules, they both fail with <package>bundle</package> Maven modules.
>
> How do you do this in OSGi context? Are there other Maven plugins
> available that work well with BND? If this is a BND bug, can it be fixed?
>
> I have asked questions on the subject here http://stackoverflow.com/**
> questions/12604161/error-**while-adding-svn-revision-in-**
> jar-manifest-with-maven-and-**maven-bundle-plug<http://stackoverflow.com/questions/12604161/error-while-adding-svn-revision-in-jar-manifest-with-maven-and-maven-bundle-plug>and there
> https://groups.google.com/**forum/?fromgroups=#!topic/**
> maven-svn-revision-number-**plugin/yvHvn1tS_2M<https://groups.google.com/forum/?fromgroups=#!topic/maven-svn-revision-number-plugin/yvHvn1tS_2M>without success so far.
>
> Kind regards,
>
> Benoît
>