Maven Central Search, or mcs for short, is a small CLI to query Maven Central from your command line. No more switching to the web browser! Now you can easily query Maven Central and find the library you’re looking for.
mcs supports the following ways of searching:
- Wildcard searchThis will give you all artifacts in Maven Central that have “picocli” in their name. The output is in a tabular form, showing the exact coordinate of each artifact and the moment when its latest version was deployed.
mcs search picocli
- Coordinate searchIf there are multiple hits, you will get the same table output as above. But if there’s only one hit, this will give you a pom.xml snippet for the artifact you searched for. Ready for copy & paste in your favourite IDE!
mcs search info:picocli mcs search info:picocli:4.6.2
- Class-name searchThis will give you all artifacts in Maven Central that contain a particular class. If you set the
mcs class-search CommandLine mcs class-search -f picocli.CommandLine
-fflag, the search term is considered a “fully classified” class name, so including the package name.
All modi recognise the
-l <number> switch, which lets you specify how many results you want to see at most.
You can get your copy of mcs through a range of package managers and distribution channels:
|Homebrew||🍎 🐧||⚠️ 1|
- The macOS and Linux binaries only work on x86_64 CPU’s. If you have a Mac with Apple Silicon, you can use mcs through Rosetta.
Alternatively, you can browse the code on GitHub.
mcs started out as a small pet project to experiment with picocli. I choose Java 17 so I could gain some experience with the latest additions to the Java programming language. Later, I’ve added GraalVM for building native images rather than JAR distributions.
- Andres Almiray did a great job helping me set up JReleaser to make releasing mcs a real breeze!
- Martin Goldhahn shared the idea of searching on class name, and provided some initial API and design ideas for this great feature.
- Willem van Lent contributed a fix for a parameter whose name didn’t match it’s behavior.
- Hanno Embregts contributed a fix that makes it more clear why the results are truncated.