Find Maven Information in JAR Files

By | May 19, 2014

In this post I will let the code do most of the talking and just tell you that I want to share a Groovy script for finding information from Maven pom.xml files embedded in JAR files.
The reason for this is that I wanted to create a list of third-party libraries and their versions that are provided in a Mule server. Since this list needs to be updated for each new version of Mule, I wanted to automate the process at least to some extent.
Of course this is applicable to other scenarios as well.


When I run the script, pointing it at the Mule 3.5.0-M4 lib directory, part of the console output looks like this:

The console output is just a progress indicator – the interesting output is written to a file where each JAR file is represented by an entry in this format:

In the above example, we can see that the wss4j-1.6.9 JAR file contains a Maven pom.xml file which specifies a parent with the group id org.apache, the artifact id apache and the version 11. The library group id is, the library artifact id is wss4j and, finally, the library version is 1.6.9.

Leave a Reply

Your email address will not be published. Required fields are marked *