Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Need help wrapping third party to a bundle
icon4.gif  Need help wrapping third party to a bundle [message #1446322] Thu, 16 October 2014 17:35 Go to next message
nemewsys hellius is currently offline nemewsys helliusFriend
Messages: 1
Registered: October 2014
Junior Member

I need to use these two packages in my code:
    import org.apache.commons.validator.routines.DomainValidator;

    import org.apache.commons.validator.routines.InetAddressValidator;

So I need to grab apache commons-validator 1.4.0 and make it a bundle.

For that I've created a new maven project, consisting only in one POM file, where the POM contains the following:



	<name>${project.groupId} - ${project.artifactId}</name>

	Demonstrates how to easily deploy the classes contained in a pre-packaged vanilla jar file into an OSGi
	container, when the jar does not contain the necessary OSGi manifest headers.




However, when I compile this project, the resulting bundle manifest will start importing new stuff... Check the Import-Package tag of the generated MANIFEST.MF here:

Manifest-Version: 1
Bnd-LastModified: 1413479060520
Build-Jdk: 1.6.0_65
Built-By: Pedro
Bundle-ClassPath: .,OSGI-INF/lib/commons-beanutils-1.8.3.jar,OSGI-INF/li
Bundle-Description: Demonstrates how to easily deploy the classes contai
 ned in a pre-packaged vanilla jar file into an OSGi	container, when the
  jar does not contain the necessary OSGi manifest headers.
Bundle-ManifestVersion: 2
Bundle-Name: apache-commons-validator-osgi - apache-commons-validator-os
Bundle-SymbolicName: apache-commons-validator-osgi
Bundle-Version: 1.4.0
Created-By: Apache Maven Bundle Plugin
Embed-Dependency: *;scope=compile|runtime
Embed-Directory: OSGI-INF/lib
Embed-Transitive: true
Export-Package: org.apache.commons.validator.javascript;version="1.4.0",
Import-Package: javax.servlet,javax.xml.parsers,org.apache.avalon.framew
Tool: Bnd-1.43.0

I would expect it to import nothing and be self-contained... I hate this stuff when working with OSGi, including 3rd party dependencies is very hard Sad

How can I make this bundle self-contained?
Re: Need help wrapping third party to a bundle [message #1447155 is a reply to message #1446322] Fri, 17 October 2014 21:58 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
This isn't really a JDT question, but I'll give some comments anyway:

OSGi isn't any harder than Maven, it's crossing the border that can cause pain. But in both worlds, an artifact / bundle is seen as a module that may depend on other modules. Making a bundle into a self-contained, standalone blob isn't a normal approach in either world.

So ideally, you would find your 3rd party libraries in Eclipse Orbit, where they're already OSGi'ified and all their dependencies are, too. Unfortunately, nobody has yet created a Orbit version of commons-validator.

Perhaps you should first use maven to get the full list of (transitive) dependencies. From there you can make the call whether transforming all those is a viable option.

Previous Topic:Hitting Breakpoints in Run -> Debug Configurations... -> Debug
Next Topic:[Kepler] exported packages don't show up for import in other plug-ins
Goto Forum:

Current Time: Sat Feb 24 13:23:59 GMT 2024

Powered by FUDForum. Page generated in 0.01597 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top