On 28/08/07, Prashant Bhat <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> How do I include resources from the dependent jar file?
> For ex. I'm converting geronimo-jpa_3.0_spec-1.1.jar to osgi bundle and
> I've
> the following definitions in pom.
>
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <version>1.0.0</version>
> <configuration>
> <instructions>
> <Bundle-Name>${artifactId}</Bundle-Name>
>
> <Bundle-SymbolicName>${groupId}.${artifactId}</Bundle-SymbolicName>
> <Export-Package>javax.persistence*;version=${jpa.version
> };-noimport:=true</Export-Package>
> <Import-Package>*</Import-Package>
> <Implementation-Version>${jpa.version
> }</Implementation-Version>
> </instructions>
> </configuration>
> <extensions>true</extensions>
> </plugin>
>
> <dependencies>
> <dependency>
> <groupId>org.apache.geronimo.specs</groupId>
> <artifactId>geronimo-jpa_3.0_spec</artifactId>
> <version>${jpa.version}</version>
> </dependency>
> </dependencies>
>
> Now, If I want to include a resource in META-INF, what instructions I
> should
> use?
> It is very much needed for some swing-ui libraries which define other
> resources at the top level of the jar.
> Are they also considered as packages or private packages?
> or
> What is the syntax for <Include-Resource> in such a scenario?
>
first some background, the general Include-Resource syntax is:
<Include-Resource>iclause,iclause,...</Include-Resource>
where:
iclause ::= inline | copy
copy ::= '{' process '}' | process
process ::= assignment | simple
assignment ::= PATH '=' PATH
simple ::= PATH
inline ::= '@' PATH ( '!/' PATH? ('/**' | '/*')? )?
( taken from the Bnd docs at http://aqute.biz/Code/Bnd#include-resource )
by default the bundle-plugin will add all maven resources to
Include-Resource,
ie. any files in src/main/resources will be copied to the bundle - so for
example
src/main/resources/META-INF/foo would be copied to META-INF/foo.
however, if you explicitly set Include-Resource then maven resources won't
be
copied unless you add {maven-resources} to the includes (see issue
FELIX-343)
now, to get back to your question :)
any dependency on the compilation classpath can be unpacked using:
@artifactId-version.jar!/PATH
so:
<Include-Resource>
@geronimo-jpa_3.0_spec-${jpa.version}.jar!/META-INF/**
</Include-Resource>
should copy the META-INF folder from the dependency into the bundle.
HTH
(PS. I don't
> have the jar file relative to pom, only a dependency is set)
that's ok - the bnd tool can use the compilation classpath to locate
resources
Thanks,
> Prashant
>
--
Cheers, Stuart