If you're using maven-bundle-plugin, you can include log4j as a
dependency and then include the log4j packages in your <Private-Package>
element.  This will cause the log4j packages to be included in your
bundle.  So, do something like this:

...

<Private-Package>org.apache.log4j.*</Private-Package>

...


<dependency>
  <groupId>log4j</groupId>
  <artifactId>log4j</artifactId>
  <version>1.2.14</version>
</dependency> 

Having just gone through a major bundling of some rather complex OS
software (aka Apache Jackrabbit) I think what you're going to find is
that as you include more of these third party jars, you're going to find
dependencies that you never dreamed existed.  Even with just log4j, you
might decide you don't want to include all the packages in the jar file,
but just include the ones that you find you need.  For me, it was a very
tedious process determining all the packages that needed to be included.

Another option, as you hinted at yourself, you could re-package the
log4j jar as a bundle, using the same process as I described above
(using maven-bundle-plugin).  I would go this route if you find that you
are using log4j in a number of bundles, versioning the bundles and the
imports appropriately.

Good luck!

Cheers,
Craig

> -----Original Message-----
> From: Jaime Osgi [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 30, 2007 4:42 AM
> To: [email protected]
> Subject: Library dependency
> 
> If my OSGi bundle depends on a .JAR file, that it's not 
> currently an OSGi bundle, how could I make it work?.
> 
> For example, if my OSGi bundle has some dependencies to Log4J 
> library (or other library), it will raise ClassNotFound 
> exceptions due for any invocation to Log4J classes. How can I 
> solve it?. Perhaps, creating an OSGi bundle with the classes 
> included in the Log4J .JAR file?. Is there any other method?.
> 
> Thanks,
> Jaime
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to