On 11/10/10 10:05, Richard S. Hall wrote:
Couldn't you just add include/exclude directives onto the exported
package?
Replying to myself after reading the whole message, I guess it wouldn't
work given what you are trying to achieve.
-> richard
-> richard
On 11/10/10 7:48, Peter Kriens wrote:
Well, bnd thinks "packages" so there is no support for class based
filtering.
That said, you might try:
b1.jar:
Include-Resource: \
@a1.jar!/!p/q/r/Foo*.class, \
@a2.jar!/!p/q/r/Foo*.class
-exportcontents: p.q.*
b2.jar
Include-Resource: \
@a1.jar!/p/q/r/Foo*Impl.class,
@a2.jar!/p/q/r/Foo*Impl.class
There is one other possibility, -donotcopy ... It is intended for
skipping .svn, CVS, etc resources. It is global and it is a REAL
regular expression (not the normal globbing).
<_donotcopy>.*Foo.*\.class|CVS|.svn</_donotcopy>
Haven't tried that though ...
The disadvantage is that Include-Resource requires access to the raw
jar and I guess you want it from the classpath because you're running
this in maven. I could if you really need this add a feature to bnd
that allows resource filtering on the Private-Package,
Export-Package, and Conditional-Package.
Kind regards,
Peter Kriens
On 2 nov 2010, at 09:02, Sahoo wrote:
[Apology if this is a duplicate. I sent the earlier email from my
Sun.COM email which does not subscribe to this ML]
I am repackaging a couple of jars into one bundle and in the
process, I have to exlclude a few classes from the second jar, as I
will be creating a second bundle containing only those excluded
classes. The motivation here is that the second bundle will act as a
fragment to the first bundle and it will be only available in
environment where its dependencies are satisfied. So, consider the
following example:
a1.jar and a2.jar are being repackages into b1.jar and b2.jar.
b1.jar contains all classes from a1.jar and a2.jar except the
classes having following pattern: p.q.r.Foo*
b2.jar contains classes having following pattern: p.q.r.Foo*Impl.
So, I am configuring my pom.xml like this:
<project>
<parent>
<groupId>xxx</groupId>
<artifactId>external</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>a1-a2--repackaged</artifactId>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.0.1</version>
<configuration>
<instructions>
<Export-Package> !p.q.r.Foo*, p.q.*</Export-Package>
<Private-Package>!*</Private-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
<executions>
<execution>
<id>osgi-bundle</id>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>p.q</groupId>
<artifactId>a1</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>p.q</groupId>
<artifactId>a2</artifactId>
<optional>1.0</optional>
</dependency>
</dependencies>
</project>
Yet, I see p.q.r.Foo, p.q.r.FooImpl and similarly named classes
being part of the bundle. What am I doing wrong. I do see the
following warning:
[WARNING] Warning building bundle
xxx:a1-a2-repackaged:jar:1.0-SNAPSHOT : Instructions in
Export-Package that are never used: *p\.q\.r\.Foo.**
So, it seems it is expecting a package pattern there and I am
trying to give a class name pattern. How to exclude a few classes then?
Thanks,
Sahoo
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]