Migrating Java projects to Maven

Migrating a non-Maven project to Maven can be a painful process. Especially, when the project has a lot of dependent libraries. Why is that a problem? Java libraries can have generic filenames (logging.jar) or the project renamed them (dropped prefix and/or version). But even if you know what project the jar is from, you quite often have to play Sherlock Holmes to determine what exact version the jar is, if the version isn’t part of the filename.

But, alas!, I figured out a quicker way of doing it!

The Advanced Search on Maven Central allows you to search for a SHA-1 checksum (bottom of screen):

Now, all you need to do is compute the SHA-1 of the jar that you are trying to look up. On Linux, you can use the sha1sum command-line utility. For Windows, you should be able to use the File Checksum Integrity Verifier (FCIV) utility for that purpose.

For example, computing the SHA-1 for commons-logging-1.1.1.jar will give you this:

$ sha1sum commons-logging-1.1.1.jar
5043bfebc3db072ed80fbd362e7caf00e885d8ae  commons-logging-1.1.1.jar

Just paste the hash into the appropriate search field on Maven Central and you will get a result like this:

Sorted! 🙂