Tuesday, June 30, 2009

Merge dependencies in maven

I have a need to merge dependencies of my Confluence JSON webservice plugin because the plugin needs 2 libraries which are json-lib and ezmorph. There are a few ways on how to do this:

  • A very naive way, by unjaring all the dependencies and my plugin together and then rejar it back. This is definitely not a good way since I want to make my plugin is installable via repository client.
  • Maven, maven provides you a way on how to merge file. The idea is to unjar the dependencies before maven package the classes to be jar file. So, what I did was to unpack the dependencies to classes directory where maven allocate the classes of my plugin after compile them.
The following is the additional pom.xml configuration for my plugin:

No comments: