Fetch Maven Central info from the Command Line

AxLabs
2 min readMar 23, 2021

Sometimes we need to fetch some Maven central information from the command line. Like, latest version, all recent versions for a particular artifact, and so on. This is particularly useful for automated builds and various reports.

We were not aware of this, and actually got positively surprised, but Maven Central (more specifically search.maven.org) provides a good range of APIs to search things in their servers. ๐Ÿ˜ฎ After all, I think it's time to stop blaming Sonatype OSS and its ecosystem for good nowโ€ฆ ๐Ÿ™ˆ

We will use neow3j project as an example in this article. ๐Ÿค”

Also, make sure you have curl and jq command-line tools installed. We will use some magic with jq, which is very useful to parse JSON in the shell.

Get the latest version of the io.neow3j:core artifact:

List the last 10 versions of io.neow3j:core artifact:

List the last 10 artifact identifiers where it contains the class io.neow3j.compiler.Compiler in the group io.neow3j:

There are many other things it's possible to do and to query. You can explore by yourself by reading their docs. ๐Ÿ™

I was thinking a bitโ€ฆ. and a next step would be to turn this into a small Javascript library. ๐Ÿš€ ๐Ÿค”

โ€ฆbut that's something for another article. ๐Ÿ˜… ๐Ÿ˜†

--

--

AxLabs

Tech thinkers & builders. Open-source freaks. Passionate about blockchain engineering. Using bleeding-edge technologies to build rock-solid products.