You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Andreas Jansson <an...@oracle.com> on 2012/02/03 22:09:48 UTC

Issue with maven-bundle-plugin and system properties

Hi all,

I have noticed an odd behavior with the maven-bundle-plugin (using 
v.2.3.6) that all system property that are set with upercase first 
letter as directly injected into the manifest. For example I run this:

mvn -DFOO=bar install

And that causes my META-INF/MANIFEST.MF contains a FOO=bar property. If 
I instead use -Dfoo=bar the same problem does not occur. My guess is 
that the bundle plugin just forwards all properties to bnd, which will 
think this is a normal manifest header.

I guess most people won't even notice this since system propperties are 
generally lower case, but in our build environment there are a lot of 
these properties that unfortunately use upper case so my manifest files 
are all cluttered with all kinds of strange headers.

My question is if there is a way to suppress it? Note that I can not 
easily change the system properties that are already set.
Also is there some intention behind this behavior, or simply a bug that 
can be address in a future version?

Thanks,
Andreas

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


Re: Issue with maven-bundle-plugin and system properties

Posted by Carsten Ziegeler <cz...@apache.org>.
I recently ran into this problem as well and while i see the
usefulness of passing things to bnd to make them available, the
problematic part is clearly that all these things might end up
unnoticed in the artifact.
In our case we had some properties in settings.xml which had no
relation to the project currently build and of course they were added
to the bundle manifest.

To some point I can agree with handling properties in the pom this way
or even properties defined by the command line, but when it comes to
unrelated things like props from the settings.xml I think we have too
much magic here.
Unfortunately there is no way in Maven to find out which properties
are defined in the settings and which come from a different location
like the pom (at least I didn't find one).
While passing things down to bnd is nice and doesn't do any harm, the
only remaining solution would be to add a whitelist to bnd.

If more people think that this is worth the effort, we should try to
push that / contribute it.

Regards
Carsten

2012/2/3 Andreas Jansson <an...@oracle.com>:
> Thanks for the quick reply Stuart,
>
> I'll see if we can do something with -removeheaders. If not I might take a
> look at the plugin source.
>
> Thanks,
> Andreas
>
>
> On 02/03/2012 01:21 PM, Stuart McCulloch wrote:
>>
>> On 3 Feb 2012, at 21:09, Andreas Jansson wrote:
>>>
>>> Hi all,
>>>
>>> I have noticed an odd behavior with the maven-bundle-plugin (using
>>> v.2.3.6) that all system property that are set with upercase first letter as
>>> directly injected into the manifest. For example I run this:
>>>
>>> mvn -DFOO=bar install
>>>
>>> And that causes my META-INF/MANIFEST.MF contains a FOO=bar property. If I
>>> instead use -Dfoo=bar the same problem does not occur. My guess is that the
>>> bundle plugin just forwards all properties to bnd, which will think this is
>>> a normal manifest header.
>>
>> Yes, all properties see by Maven are forwarded onto bnd so people can
>> reference them in bnd instructions or macros - and by default bnd adds any
>> property that starts with an upper-case letter to the manifest
>>
>> You can tell bnd to remove headers using
>>
>>    -removeheaders: Foo, Bar, Example
>>
>> in your osgi.bnd file, or
>>
>>    <_removeheaders>Foo, Bar, Example</_removeheaders>
>>
>> in your pom.xml file - see http://www.aqute.biz/Bnd/Format
>>
>>> I guess most people won't even notice this since system propperties are
>>> generally lower case, but in our build environment there are a lot of these
>>> properties that unfortunately use upper case so my manifest files are all
>>> cluttered with all kinds of strange headers.
>>>
>>> My question is if there is a way to suppress it? Note that I can not
>>> easily change the system properties that are already set.
>>> Also is there some intention behind this behavior, or simply a bug that
>>> can be address in a future version?
>>
>> We don't know what properties someone might use in their
>> instructions/macros, so we just forward everything onto bnd - if you have
>> any idea to trim down this list without affecting users feel free to attach
>> a patch to JIRA
>>
>> Alternatively, if you have a suggested improvement for bnd (such as an
>> option to only add the OSGi headers, or maybe a whitelist of acceptable
>> headers) then feel free to raise this on https://github.com/bndtools/bnd
>>
>>> Thanks,
>>> Andreas
>>>
>>> ---------------------------------------------------------------------
>>> 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
>



-- 
Carsten Ziegeler
cziegeler@apache.org

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


Re: Issue with maven-bundle-plugin and system properties

Posted by Andreas Jansson <an...@oracle.com>.
Thanks for the quick reply Stuart,

I'll see if we can do something with -removeheaders. If not I might take 
a look at the plugin source.

Thanks,
Andreas

On 02/03/2012 01:21 PM, Stuart McCulloch wrote:
> On 3 Feb 2012, at 21:09, Andreas Jansson wrote:
>> Hi all,
>>
>> I have noticed an odd behavior with the maven-bundle-plugin (using v.2.3.6) that all system property that are set with upercase first letter as directly injected into the manifest. For example I run this:
>>
>> mvn -DFOO=bar install
>>
>> And that causes my META-INF/MANIFEST.MF contains a FOO=bar property. If I instead use -Dfoo=bar the same problem does not occur. My guess is that the bundle plugin just forwards all properties to bnd, which will think this is a normal manifest header.
> Yes, all properties see by Maven are forwarded onto bnd so people can reference them in bnd instructions or macros - and by default bnd adds any property that starts with an upper-case letter to the manifest
>
> You can tell bnd to remove headers using
>
>     -removeheaders: Foo, Bar, Example
>
> in your osgi.bnd file, or
>
>     <_removeheaders>Foo, Bar, Example</_removeheaders>
>
> in your pom.xml file - see http://www.aqute.biz/Bnd/Format
>
>> I guess most people won't even notice this since system propperties are generally lower case, but in our build environment there are a lot of these properties that unfortunately use upper case so my manifest files are all cluttered with all kinds of strange headers.
>>
>> My question is if there is a way to suppress it? Note that I can not easily change the system properties that are already set.
>> Also is there some intention behind this behavior, or simply a bug that can be address in a future version?
> We don't know what properties someone might use in their instructions/macros, so we just forward everything onto bnd - if you have any idea to trim down this list without affecting users feel free to attach a patch to JIRA
>
> Alternatively, if you have a suggested improvement for bnd (such as an option to only add the OSGi headers, or maybe a whitelist of acceptable headers) then feel free to raise this on https://github.com/bndtools/bnd
>
>> Thanks,
>> Andreas
>>
>> ---------------------------------------------------------------------
>> 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: Issue with maven-bundle-plugin and system properties

Posted by Stuart McCulloch <mc...@gmail.com>.
On 3 Feb 2012, at 21:09, Andreas Jansson wrote:
> Hi all,
> 
> I have noticed an odd behavior with the maven-bundle-plugin (using v.2.3.6) that all system property that are set with upercase first letter as directly injected into the manifest. For example I run this:
> 
> mvn -DFOO=bar install
> 
> And that causes my META-INF/MANIFEST.MF contains a FOO=bar property. If I instead use -Dfoo=bar the same problem does not occur. My guess is that the bundle plugin just forwards all properties to bnd, which will think this is a normal manifest header.

Yes, all properties see by Maven are forwarded onto bnd so people can reference them in bnd instructions or macros - and by default bnd adds any property that starts with an upper-case letter to the manifest

You can tell bnd to remove headers using

   -removeheaders: Foo, Bar, Example

in your osgi.bnd file, or

   <_removeheaders>Foo, Bar, Example</_removeheaders>

in your pom.xml file - see http://www.aqute.biz/Bnd/Format

> I guess most people won't even notice this since system propperties are generally lower case, but in our build environment there are a lot of these properties that unfortunately use upper case so my manifest files are all cluttered with all kinds of strange headers.
> 
> My question is if there is a way to suppress it? Note that I can not easily change the system properties that are already set.
> Also is there some intention behind this behavior, or simply a bug that can be address in a future version?

We don't know what properties someone might use in their instructions/macros, so we just forward everything onto bnd - if you have any idea to trim down this list without affecting users feel free to attach a patch to JIRA

Alternatively, if you have a suggested improvement for bnd (such as an option to only add the OSGi headers, or maybe a whitelist of acceptable headers) then feel free to raise this on https://github.com/bndtools/bnd

> Thanks,
> Andreas
> 
> ---------------------------------------------------------------------
> 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