On 14 Mar 2013, at 17:26, David Bosschaert wrote:

> Thanks for the response, Stuart.
> 
> So I added the following:
>  <_wab>src/main/webapp</_wab>
> (that's where I have my web.xml)
> 
> However this still doesn't compute the Bundle-ClassPath for me to contain
> all the jars in the WEB-INF/lib.
> I tried adding the following:
>  <_wablib>WEB-INF/lib/*.jar</_wablib>
> since the jars are already inside the WEB-INF/lib directory in the .WAR
> file that is in the dependency list, but that doesn't work. (Complains that
> this doesn't exist in the current module).
> 
> Additionally, using _wab moves all the static web resources from the
> original .WAR to the WEB-INF/classes directory. But these need to stay at
> the root...
> 
> Any ideas?

The Embed-Dependency code manipulates the Include-Resource and Bundle-ClassPath 
instructions for you, but unfortunately doesn't appear to play well with WABs 
so that'll need some investment of time to fix up.

As a workaround you can unpack the WAR as part of the build (this also works 
around issues wrt. transitive dependencies when depending on the artifact 
you're bundling) and include it into the WAB as follows: 

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>unpack-war</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.acme</groupId>
                  <artifactId>acme-war</artifactId>
                  <version>1.0.0</version>
                  <type>war</type>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.3.7</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <_wab>src/main/webapp,target/dependency</_wab>
            
<_wablib>$(replace;$(lsr;target/dependency/WEB-INF/lib/);^;target/dependency/WEB-INF/lib/)</_wablib>
          </instructions>
        </configuration>
      </plugin>
    </plugins>

There seems to be an issue with the "lsa" macro when using bundleplugin 2.3.7, 
so resorted to using "lsr" (ie. list relative) then prefixed all the results 
appropriately.

HTH

> Cheers,
> 
> David
> 
> On 14 March 2013 17:08, Stuart McCulloch <[email protected]> wrote:
> 
>> On 14 Mar 2013, at 16:58, David Bosschaert wrote:
>> 
>>> Hi all,
>>> 
>>> I'm using the maven-bundle-plugin (2.3.7) to turn a .WAR file into an
>> OSGi
>>> WAB.
>>> 
>>> In my maven dependencies I depend on the WAR file like this:
>>>   <dependency>
>>>     <groupId>org.acme</groupId>
>>>     <artifactId>acme-war</artifactId>
>>>     <version>1.0.0</version>
>>>     <type>war</type>
>>>   </dependency>
>>> The war file contains a bunch of embedded jar files in its WEB-INF/lib
>>> directory.
>>> 
>>> This maven module also adds some additional classes so I'd like the
>> mbp/bnd
>>> to generate the OSGi Manifest. This seems to work with the following
>>> maven-bundle-plugin configuration:
>>> <Embed-Directory>/</Embed-Directory>
>>> <Embed-Dependency>*;scope=compile;inline=true</Embed-Dependency>
>>> 
>>> I set the embed directory to / because the acme-war that I depend on
>>> already has the right structure...
>>> So all the artifacts are in my generated bundle in the place where I want
>>> them, but now I need to generate the Bundle-ClassPath to list all the jar
>>> files in WEB-INF/lib. I tried
>>> 
>>> 
>> <Bundle-ClassPath>.,{maven-dependencies},WEB-INF/classes</Bundle-ClassPath>
>>> but that doesn't work. I also tried:
>>> <Bundle-ClassPath>.,WEB-INF/lib/*.jar,WEB-INF/classes</Bundle-ClassPath>
>>> but that doesn't expand *.jar.
>>> 
>>> Anyone an idea?
>> 
>> Why not use the <_wab/> BND instruction?
>> http://www.aqute.biz/Bnd/Format#wab
>> 
>> Also note that the default Embed-Directory will put the embedded/inlined
>> content in the root of your bundle, so you shouldn't need to set it to '/'.
>> 
>>> Cheers,
>>> 
>>> David
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to