You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Sahoo <Sa...@Sun.COM> on 2008/03/31 15:46:22 UTC

[maven-bundle-plugin] How to stop exporting a resource from an inlined jar?

Hi,

I am trying to use maven-bundle-plugin v1.4.0. I prepare a bundle (say 
bundle.jar) which inlines the contents of another jar type artifact 
called javax.faces:jsf-impl. There is a resource called 
META-INF/services/com.sun.faces.spi.injectionprovider which is present 
both in the jsf-impl.jar as well in current project's src/main/resources 
area. I want to package the one that's in our workspace. So, I 
configured the plugin like this:

<configuration>
    <Embed-Dependency>
    *;groupId=javax.faces;artifactId=jsf-impl;inline=true
    </Embed-Dependency>
   
    <!-- Package everything from the embedded jar in the
       final bundle except the following file which
       we maintain in our src/main/resources dir:
       META-INF/services/com.sun.faces.spi.injectionprovider
    -->
    <_exportcontents>
     !META-INF/services/com.sun.faces.spi.injectionprovider,*
    </_exportcontents>
</configuration>

Yet, I see the resource that is being packaged in the bundle is the one 
from jsf-impl.jar and not from target/classes/... area. What am I doing 
wrong?

Thanks,
Sahoo

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


Re: [maven-bundle-plugin] How to stop exporting a resource from an inlined jar?

Posted by Sahoo <Sa...@Sun.COM>.
Stuart McCulloch wrote:
> On 31/03/2008, Sahoo <Sa...@sun.com> wrote:
>   
>> Hi,
>>
>> I am trying to use maven-bundle-plugin v1.4.0. I prepare a bundle (say
>> bundle.jar) which inlines the contents of another jar type artifact
>> called javax.faces:jsf-impl. There is a resource called
>> META-INF/services/com.sun.faces.spi.injectionprovider which is present
>> both in the jsf-impl.jar as well in current project's src/main/resources
>> area. I want to package the one that's in our workspace. So, I
>> configured the plugin like this:
>>
>> <configuration>
>>     <Embed-Dependency>
>>     *;groupId=javax.faces;artifactId=jsf-impl;inline=true
>>     </Embed-Dependency>
>>
>>     <!-- Package everything from the embedded jar in the
>>        final bundle except the following file which
>>        we maintain in our src/main/resources dir:
>>        META-INF/services/com.sun.faces.spi.injectionprovider
>>     -->
>>     <_exportcontents>
>>      !META-INF/services/com.sun.faces.spi.injectionprovider,*
>>     </_exportcontents>
>> </configuration>
>>
>> Yet, I see the resource that is being packaged in the bundle is the one
>> from jsf-impl.jar and not from target/classes/... area. What am I doing
>> wrong?
>>     
>
>
> currently embedded dependencies are added to the Include-Resource
> statement after the maven resources - unfortunately this means that any
> inlined entries will overwrite local entries, which isn't optimal :(
>
> I'll change this ordering round in 1.4.1 (open a JIRA issue to remind me)
>
> you'll also be able to customize the Include-Resource better in 1.4.1, eg:
>
>    <Include-Resource>
>       {maven-dependencies},some-file,{maven-resources},another-file
>    </Include-Resource>
>
> where {maven-dependencies} and {maven-resources} expand to the list of
> embedded entries and maven resources respectively - you can already do
> this to some extent with 1.4.0, but there's a bug on Windows with replacing
> the "{maven-dependencies}" token...
>
> so the workaround with 1.4.0 would be to use something like this in place
> of the Embed-Dependency - you'll need to list each dependency explicitly
> using @artifactId-version.jar to inline it (this is what Embed-Dependency
> does under the covers) for example:
>
>    <Include-Resource>
>       @jsf-impl-1.2-b19.jar,{maven-resources}
>    </Include-Resource>
>
> will inline the JSF jar and then overlay resources from the current project
>
> HTH
Your fast response is really appreciated. Yes, the suggested work around 
solves the problem. I have filed 
https://issues.apache.org/jira/browse/FELIX-526 as an improvement 
request for 1.4.1 as per your suggestion.

Thanks,
Sahoo


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


Re: [maven-bundle-plugin] How to stop exporting a resource from an inlined jar?

Posted by Stuart McCulloch <st...@jayway.net>.
On 31/03/2008, Sahoo <Sa...@sun.com> wrote:
>
> Hi,
>
> I am trying to use maven-bundle-plugin v1.4.0. I prepare a bundle (say
> bundle.jar) which inlines the contents of another jar type artifact
> called javax.faces:jsf-impl. There is a resource called
> META-INF/services/com.sun.faces.spi.injectionprovider which is present
> both in the jsf-impl.jar as well in current project's src/main/resources
> area. I want to package the one that's in our workspace. So, I
> configured the plugin like this:
>
> <configuration>
>     <Embed-Dependency>
>     *;groupId=javax.faces;artifactId=jsf-impl;inline=true
>     </Embed-Dependency>
>
>     <!-- Package everything from the embedded jar in the
>        final bundle except the following file which
>        we maintain in our src/main/resources dir:
>        META-INF/services/com.sun.faces.spi.injectionprovider
>     -->
>     <_exportcontents>
>      !META-INF/services/com.sun.faces.spi.injectionprovider,*
>     </_exportcontents>
> </configuration>
>
> Yet, I see the resource that is being packaged in the bundle is the one
> from jsf-impl.jar and not from target/classes/... area. What am I doing
> wrong?


currently embedded dependencies are added to the Include-Resource
statement after the maven resources - unfortunately this means that any
inlined entries will overwrite local entries, which isn't optimal :(

I'll change this ordering round in 1.4.1 (open a JIRA issue to remind me)

you'll also be able to customize the Include-Resource better in 1.4.1, eg:

   <Include-Resource>
      {maven-dependencies},some-file,{maven-resources},another-file
   </Include-Resource>

where {maven-dependencies} and {maven-resources} expand to the list of
embedded entries and maven resources respectively - you can already do
this to some extent with 1.4.0, but there's a bug on Windows with replacing
the "{maven-dependencies}" token...

so the workaround with 1.4.0 would be to use something like this in place
of the Embed-Dependency - you'll need to list each dependency explicitly
using @artifactId-version.jar to inline it (this is what Embed-Dependency
does under the covers) for example:

   <Include-Resource>
      @jsf-impl-1.2-b19.jar,{maven-resources}
   </Include-Resource>

will inline the JSF jar and then overlay resources from the current project

HTH

Thanks,
> Sahoo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
-- 
Cheers, Stuart