I've inherited an Ant-based project that has over 80MB of jar files in a lib dir. I'd like to convert it to Maven. The jar files are named very simply, like quartz.jar
. Since there is no indication of group id, much less version, converting this to pom.xml
format is going to be very painful.
Is there a service or API that will return the Maven coordinates (group, artifact, version) for a jar file, given its SHA?
My fallback will be to examine the MANIFEST
file from each jar, which will at least give me version info, if not specific Maven coordinates.
JAR files are packaged in the ZIP file format. The unzip command is a commonly used utility for working with ZIP files from the Linux command-line. Thanks to the unzip command, we can view the content of a JAR file without the JDK.
A JAR file is essentially a zip file that contains an optional META-INF directory. A JAR file can be created by the command-line jar tool, or by using the java. util. jar API in the Java platform.
You can produce a jar which will include your test classes and resources. To reuse this artifact in an other project, you must declare this dependency with type test-jar : <project>
Ah, looks like I needed to Google on "checksum search", rather than "SHA". That turned up this page:
How to Convert from Ant to Maven in 5 Minutes
... which explains that you can use the checksum search
on this page.
Based on this info, I just coded up a quick project on Github that will use this API and generate the XML dependencies stanza automatically. You can use it like:
$ java com.armhold.Provenance lib_dir
And it will print out the Maven coords for each jar file it finds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With