2008/10/23 Huang, Kevin BGI SYD <[EMAIL PROTECTED]>

> Hi everyone,
>
> I've noticed some strange behaviour with the maven bundle plugin 1.4.3.
> It doesn't seem to include the resources that have been filtered but
> rather copy the pre-filtered resources to the jar.
>
> e.g.
>
> pom.xml
>
>    <build>
>        <filters>
>            <filter>src/main/filters/dev.properties</filter>
>        </filters>
>        <resources>
>            <resource>
>                <directory>src/main/resources</directory>
>                <filtering>true</filtering>
>                <includes>
>                    <include>**/*.xml</include>
>                </includes>
>            </resource>
>        </resources>
>    </build>
>
> The xml files are correctly filtered with packaging is jar instead of
> bundle. The classes dir in the target dir contains the correctly filtered
> files,
> but they are not included in the final jar.
>
> Can anyone else confirm this?
>

yes, this is a missing feature - filter files are currently not passed onto
Bnd

the maven-bundle-plugin acts as a bridge between Maven and the Bnd tool,
and as such it uses a different approach (compared to the maven-jar-plugin)
to pull classes and resources into the bundle - it does not just jar up
whatever
is in "target/classes", rather it uses Bnd to pull the bundle together

one such difference is that Bnd is used to filter resource files (when
required)
- we already pass pom properties onto Bnd, so it can take these into account
but don't yet pass the resource filter property files, which is why the
files look
as though they haven't been filtered

feel free to open a feature request (
http://issues.apache.org/jira/browse/FELIX)

as a workaround you can always pass your filter files directly to Bnd using:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <_include>-src/main/filters/dev.properties</_include>
            <!-- etc... -->
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>

and it should then apply those properties to the resource files.

Regards,
>
> Kevin Huang
>

-- 
Cheers, Stuart

Reply via email to