You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by "Huang, Kevin BGI SYD" <Ke...@barclaysglobal.com> on 2008/10/23 02:30:03 UTC
possible bug with maven bundle plugin
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?
Regards,
Kevin Huang
System Development Engineer
Barclays Global Investors
Australia
Phone: 61 - 2 - 92722392
Fax: 61 - 2 - 92785392
--
This message and any attachments are confidential, proprietary, and may be privileged. If this message was misdirected, Barclays Global Investors (BGI) does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BGI, unless the author is authorized by BGI to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BGI. Although BGI operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed.
RE: possible bug with maven bundle plugin
Posted by "Huang, Kevin BGI SYD" <Ke...@barclaysglobal.com>.
Hi Stuart,
Thanks for the reply, I was however unable to get the bnd tool to
perform the correct filtering.
However I was able to get it working using a combination of bundle
plugin and jar plugin:
<build>
<filters>
<filter>src/main/filters/${build.type}.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</man
ifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.3</version>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I have also added this issue as a new feature request on jira:
https://issues.apache.org/jira/browse/FELIX-791
Thanks,
Kevin
-----Original Message-----
From: Stuart McCulloch [mailto:mcculls@gmail.com]
Sent: Thursday, 23 October 2008 6:57 PM
To: users@felix.apache.org
Subject: Re: possible bug with maven bundle plugin
2008/10/23 Huang, Kevin BGI SYD <Ke...@barclaysglobal.com>
> 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
--
This message and any attachments are confidential, proprietary, and may be privileged. If this message was misdirected, Barclays Global Investors (BGI) does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BGI, unless the author is authorized by BGI to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BGI. Although BGI operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: possible bug with maven bundle plugin
Posted by Stuart McCulloch <mc...@gmail.com>.
2008/10/23 Huang, Kevin BGI SYD <Ke...@barclaysglobal.com>
> 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