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. 😅 😆