About

POMStrap is a little opensource (BSD License) library whose purpose is to solve the java JAR hell problem.
POMStrap works as an application bootstrap that builds classloaders tree based on Maven 2 dependencies declared in project files (pom).

Using POMStrap allows you to execute an application depending on multiple versions of a library.

POMStrap create one classloader for each dependency artifact (jar) with an hierachical 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 completly 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 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 differents 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 futur JDK (1.7+).

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 completly fixe (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 lauch 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

Check the source on tigris web site.
POMStrap 1.0.12 source is available for download here.
POMStrap 1.0.12 binary is avaible here.
API Javadoc is located here.

Contacts

Report any bugs here.
Check the discussion forum.
Subscrib to mailinglist.
You can contact me alag [at] tigris.org




Check also OpenIM and XMLPersistence projects.
PomStrap 1.0.12 is out
28/09 - 10h46
Release 1.0.12 is now available. This version fixes few bugs, and add a simple authenticator for remote repositories that requires an user/pass. Thanks to Alessandro for submitting his patch.
POMStrap 1.0.11 released
16/06 - 11h59
POMStrap groupId in pom has be changed to org.tigris.pomstrap to match Maven recommendation. This release also includes few small minor adjustments.