Search maven from the commandline using httpie and jq

Sometimes I like to know what the latest version of a library in maven central is. As I don’t like to always open a browser tab for search but almost always have a terminal window at hand, I just wrote s small script that uses httpie and jq to get the information I want (that’s all one line in the script):

#!/usr/bin/env sh

http rows==10000 q=="$1" | jq '[] | .timestamp |= (. / 1000 | todate) | (.timestamp)+" "+(.id)+":"+(.latestVersion)' | tr -d '"' | sort -k2

The script retrieves the searched values from, setting the limit to 1000, the default is 10. Then it uses jq to parse the returned JSON. The timestamp field is formatted to a readable format and then is printed along with the maven id and the latest version number. The quotes are removed from the output and it is sorted by the artifact id.

I saved this script as smvn and made it executable.

A sample run:

$ smvn "springframework elasticsearch"
2020-09-17T14:37:19Z org.springframework.boot:spring-boot-starter-data-elasticsearch:2.3.4.RELEASE


fix maven-release-plugin not committing changed pom.xml when using git repository

With one of my projects I just had the problem that the maven-release-plugin did not work as expected: I did a mvn release:prepare, answered the questions about the version number of the release and the next snapshot version, but the release plugin did not work as expected:

The version in the pom.xml was updated to the release version, the pom.xml was added to git stage, but not committed. After that, the new tag was created on the version that had still the pom.xml with the SNAPSHOT release, and the mvn release:perform was not building the release version, but still the snapshot version.

I don’t know wether this is a bug in the git version, the maven-release-plugin or the maven-scm-provider, but setting the maven components to the following fix versions (at the moment the actual ones to be found in maven central) solved the problem for me:



Update of maven module version reference to parent pom

In a multi-module maven project the poms of the modules refer to the parent pom by using the parent’s version number. The module’s version normally will be taking from the parent pom. If the parent’s version changes, all the modules poms must be updated to reflect this change. This can be automatically done with the command:

mvn -N versions:update-child-modules