felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: resource filtering and bundle packaging
Date Sat, 12 May 2007 22:53:38 GMT
I think this situation is not so straightforward.

The issue that we face here is that we have two different actors trying 
to control what gets included in the resulting bundle JAR file, i.e., 
BND and Maven.

It is not the case that BND copies the raw resources, the issue is that 
BND is probably overwriting the copied resources when generating the 
bundle content because it defaults to "src/main/resources" like Maven 
without property substitution. You can tell BND to use property 
substitution too (e.g., "{src/main/resources}"), then it might work the 
way that you want.

Ultimately, I would argue that users of maven-bundle-plugin should let 
the plugin (i.e., BND) be in control of defining the content of the JAR 
and to not use Maven's facilities at all for class or resource 
inclusion. This means that the content of the JAR file would be 
completely discernible from <Private-Package>, <Export-Package>, and 
<Include-Resource>.

I agree that we could perhaps come up with a better default value for 
<Include-Resource>, which could suck in the values of <resources/>, so 
that way if people do use it they get closer to what they are expecting. 
This is essentially the patch that Alin submitted in the body of 
FELIX-261. I would, however, argue against the patch submitted by 
Stuart, since this appears to convert the resources into the target 
directories, which then relies on Maven copying them in there, when BND 
already has that capability.

Obviously, this is not a clear cut situation, but from my point of view 
we should encourage users of the plugin to rely on the plugin for all of 
their needs as the proper way of using it. In the end, this will be 
beneficial if they ever need to change their build to use BND stand 
alone or use it with the Ant task, because the <instructions> will be 
self-contained.

-> richard

Stuart McCulloch wrote:
> Yep - the current snapshot of the bundle-plugin adds 'src/main/resources'
> to the BND directives using Include-Resource, instead of using the target
> path which has the filtered files.
>
> There's an open bug (http://issues.apache.org/jira/browse/FELIX-261) to
> address this issue, and also use maven configured resources instead of
> a hard-coded location - see patch attached to FELIX-261.
>
> I've been using this patch in the OPS4J branch of the bundle plugin (used
> for testing patches and new features) and it seems to work ok, but would
> appreciate if someone from Maven (Carlos?) could check it over.
>
> Until then, workaround is to provide your own Include-Resource setting :(
>
> On 09/05/07, Costin Leau <costin.leau@gmail.com> wrote:
>> Hi,
>>
>> I'm not sure if it's me but I've noticed that resource filtering doesn't
>> work any more if bundle packaging is used.
>>
>> If I have a file inside src/main/resources with a property:
>> Hello ${name}, with bundle packaging, the 'unexpanded' version is
>> included in the jar while the expanded version (Hello this is the name)
>> from target/classes is ignored.
>>
>>
>> Cheers,
>> -- 
>> Costin
>>
>
>

Mime
View raw message