About

POMStrap V2 is now hosted on http://pomstrap.jfluid.com.

POMStrap is a little opensource (BSD License) library whose purpose is to solve the java JAR hell problem based on Maven2 Project Object Model (POM) and classloaders modularization.
POMStrap works as an application bootstrap that builds classloaders tree based on Maven 2 dependencies declared in project files (POM), allowing you to execute an application depending on multiple versions of the same library.

POMStrap creates one classloader for each dependency artifact (jar) with a hierarchical association structure as described in Maven POM dependencies section. A POMStrap classloader will be linked to child and parent classloaders and will fetch the complete dependency tree respecting all version number.
 
When a class needs to be loaded it asks for it to its current classloader. If the class is not found in the current classloader, it asks for it to the "child" classloaders (and not to its parent as it is this case with most of application servers). If the class is not found in his children classloaders, then it ask for the class to its parents and cousins.

This approach avoid completely the problem of having conflict with multiple versions of jar file in an application.

I've personally experienced this problem when I was using FOP and Batik simultaneously: FOP required a specific old version of Batik to work (and render vector images) and was incompatible with the last Batik release, and I needed to use the latest version of Batik for image rendering at the same time. With POMStrap I've been able to handle 2 different version of Batik in the same application.

BTW, POMStrap allows you clean separation of concern within your application (for component oriented architecture), providing strict hierarchical classloader confinement.

You can also read Don Schwarz article on "Managing Component Dependencies Using ClassLoaders" to have a better understanding of Dependency & Classloaders management.

Those problems are now mostly addressed by Java Module System (JSR 277) and should be resolved in future JDK (1.7+), see also Project Jigsaw.

POMStrap is hosted on Tigris.org community server.

Maven

Maven allows you to define via a project file all dependencies of your application. Maven 2 has also a support for transitive dependency: if A depends on B and B depends on C you don't have to declare on A project file the C dependency (C is directly fetched from B dependency declaration).

But Maven 2 doesn't completely fix (yet) the versioning problem. For example, if your application A-1.0 depends on B-1.0 and C-1.0 and C itself depends on B-2.0, you will have a dependency version conflict: the application classloader will provide B-1.0 classes when executing C-1.0 code (instead of B-2.0 as expected).

Also POMStrap is not handling dependencies exactly the same way maven 2 exec plugin does. POMStrap has better hierarchical confinement and smaller footprint.


Features

POMStrap features:

Clean application dependency containment (with classloader for each component) based on Maven POM definition.
Simple and lightweight application bootstrap based on POM.
Maven 2 plugin.
Servlet and JBoss SAR integration.


POMStrap is able to load application dependency as they are declared in Maven 2 project file, and execute each dependency in its own classloader without inhering from its parent avoiding version conflict.

By using POMStrap you will be able to have an application dependency schema such as:

Application-1.0
+ DepA-1.0
+ DepB-1.0
+ DepA-2.0
Here, Application-1.0 will use DepA-1.0 and DepB-1.0 will execute DepA-2.0 classes (and not DepA-1.0 as it would be without POMStrap).


Limitations

Classes trying to access protected member of other classes located in same package but in different jar have to be grouped manually using "pomstrap.customgroup" property (see FAQ section).


Servlet and JBoss

You can use POMStrap via a Servlet with similar init-parameters configuration (see provided example sources).

A JBoss POMStrap Service is also available and allows you to launch applications as JBoss Service (via .sar file deployed in a JBoss instance).

By the way, POMStrap can easily be embedded in your application with minimal impact (since it does not require any external library).

Status

POMStrap is actively maintained by the project owner.
POMStrap is deployed in many middle size applications (as standalone apps or servlet) and is performing as expected without any troubles.

Download

POMStrap V2 is available on Jfluid.
Check the source on tigris web site.
POMStrap 1.0.14 source is available for download here.
POMStrap 1.0.14 binary is available here.
API Javadoc is located here.

Contacts

Report any bugs here.
Check the discussion forum.
Subscribe to mailinglist.
You can contact me at: alag [at] tigris.org
Twitter: http://twitter.com/aagahi



Check also NDJIN, OpenIM and XMLPersistence projects.
PomStrap 1.0.14 released
02/07 - 16h31
This is a major bugfix release for PomStrap. Also we included few optimization to accelerate classloading process.
PomStrap 1.0.13 released
25/02 - 11h08
We fixed 2 major bugs : the dependency classloader now act as it should (previously it did a deep tree scan instead of checking all classloader at level n before going n+1) and the dependency tree builder mixed version and scope is some case.