Maven Central Search (mcs) is a command line device to retrieve dependency coordinates from Maven Central. The device makes use of Picocli for the command line interface and GraalVM to compile executable native photos for macOS, Linux and Home windows.
The wildcard search possibility shows all artifacts from Maven Central containing the offered argument of their title. The next instance retrieves all artifacts, containing spring-boot-starter, together with the date of the final launch:
mcs search spring-boot-starter
Looking for spring-boot-starter...
Discovered 4626 outcomes (exhibiting 20)
Coordinates Final up to date
=========== ============
org.teasoft:bee-spring-boot-starter 13 Sep 2022 at 12:40 (CEST)
com.infilos:relax-spring-boot-starter 13 Jun 2022 at 16:27 (CEST)
io.sreworks:tesla-spring-boot-starter 06 Jun 2022 at 10:01 (CEST)
com.seepine:spring-boot-starter-parent 05 Jun 2022 at 14:50 (CEST)
io.nats:nats-spring-boot-starter 25 Might 2022 at 14:36 (CEST)
…
The coordinate search retrieves all artifacts for the offered coordinate:
mcs search org.springframework.boot:spring-boot-starter
Looking for org.springframework.boot:spring-boot-starter...
Discovered 170 outcomes (exhibiting 20)
Coordinates Final up to date
=========== ============
org.springframework.boot:spring-boot-starter:2.7.5 20 Oct 2022 at 15:26 (CEST)
org.springframework.boot:spring-boot-starter:2.6.13 20 Oct 2022 at 11:56 (CEST)
org.springframework.boot:spring-boot-starter:2.7.4 22 Sep 2022 at 13:44 (CEST)
org.springframework.boot:spring-boot-starter:2.6.12 22 Sep 2022 at 11:32 (CEST)
org.springframework.boot:spring-boot-starter:2.7.3 18 Aug 2022 at 08:30 (CEST)
…
The pom.xml
configuration is proven as an alternative of a desk every time Maven Central returns precisely one outcome:
mcs search org.springframework.boot:spring-boot-starter:2.7.5
Looking for org.springframework.boot:spring-boot-starter:2.7.5...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<model>2.7.5</model>
</dependency>
All mcs
instructions assist the -l <quantity>
argument to specify the utmost variety of outcomes:
mcs search -l 3 org.springframework.boot:spring-boot-starter
Looking for org.springframework.boot:spring-boot-starter...
Discovered 170 outcomes (exhibiting 3)
Coordinates Final up to date
=========== ============
org.springframework.boot:spring-boot-starter:2.7.5 20 Oct 2022 at 15:26 (CEST)
org.springframework.boot:spring-boot-starter:2.6.13 20 Oct 2022 at 11:56 (CEST)
org.springframework.boot:spring-boot-starter:2.7.4 22 Sep 2022 at 13:44 (CEST)
Retrieving artifacts containing a particular class title is feasible with class title search:
mcs class-search Joiners
Looking for artifacts containing Joiners...
Discovered 232 outcomes (exhibiting 20)
Coordinates Final up to date
=========== ============
io.github.light0x00:to-be-graceful:0.0.2 23 Aug 2022 at 16:24 (CEST)
io.github.light0x00:to-be-graceful:0.0.1 20 Aug 2022 at 12:28 (CEST)
me.hao0:diablo-common:1.0.2 10 Oct 2016 at 15:57 (CEST)
…
Optionally, the -f
flag could also be used to specify a totally labeled class title:
mcs class-search -f org.optaplanner.core.api.rating.stream.Joiners
Looking for artifacts containing org.optaplanner.core.api.rating.stream.Joiners...
Discovered 106 outcomes (exhibiting 20)
Coordinates Final up to date
=========== ============
org.optaplanner:optaplanner-core:7.65.0.Closing 03 Feb 2022 at 19:54 (CET)
org.optaplanner:optaplanner-core-impl:8.29.0.Closing 14 Oct 2022 at 14:17 (CEST)
org.optaplanner:optaplanner-core-impl:8.28.0.Closing 26 Sep 2022 at 12:13 (CEST)
…
The command-line interplay is constructed with Picocli, a one-file Java framework that makes it simpler to create command-line functions. Picocli helps TAB completion, possibility parameters, and subcommands. Purposes utilizing Picocli could also be compiled forward of time to a GraalVM native picture which ends up in a single executable file.
mcs
could also be put in on macOS, Linux, and Home windows with the Homebrew, Snap, SDKMAN!, and Chocolatey bundle managers. The launch course of of mcs
is automated utilizing JReleaser.
InfoQ spoke to Maarten Mulders, IT Architect at Information Assist, Java Champion and the creator of mcs
.
InfoQ: What was the inspiration for creating the mission?
Mararten Mulders: I learn an article within the NLJUG “Java Journal” by Julien Lengrand-Lambert about creating CLI’s with Kotlin and PicoCLI. It made me curious. Wouldn’t it actually be really easy? My fingers the place itching, however I did not actually have a objective but. And simply doing once more what was written out within the article appeared boring to me. On the identical time, I discovered myself usually switching from my editor or command line to an internet browser, solely to go to search.maven.org for trying up precise Maven coordinates. Voilà , my use case was there. As I did not know a lot Kotlin again then, I made a decision to go along with Java 17.
InfoQ: Which is your favourite characteristic of mcs?
Mulders: That will be the truth that you probably have specified the precise coordinates of an artifact, mcs will output the
pom.xml
snippet for you. I am nonetheless considering if I may present the snippet for extra conditions. As an illustration, if you specify agroupId
+artifactId
along with a brand new command line flag equivalent to--latest
. However I have never fairly made up my thoughts about that concept.
InfoQ: Are you able to already inform us one thing about upcoming options?
Mulders: I’ve already had (and rejected!) so many concepts! However one of many extra attention-grabbing concepts that was proposed, fairly some time in the past by Benjamin Marwell, is to embrace a vulnerability rating. I nonetheless should dive a bit into the small print. Most particularly, there appears to be an API offered by Sonatype for this function, however you possibly can’t invoke it too usually except you create an account.
InfoQ: What do you want most about sustaining the mission?
Mulders: I just like the interactions with customers of the device, folks telling me how helpful it’s to them. Additionally, I’ve had fairly a couple of attention-grabbing conversations, each on-line and offline, about new options and whether or not/how they would slot in the device. I ought to undoubtedly embrace the truth that releasing the mission is known as a matter of two mouse clicks and a little bit of persistence. A couple of minutes later, the brand new model will probably be out, printed by way of main distribution channels like SDKMAN!, Homebrew and Chocolatey. That deserves a shout-out to Andres Almiray – he gave me loads of assist in establishing JReleaser in order that creating a brand new launch is definitely a enjoyable factor to do, reasonably than a “fingers crossed” one.
Initially launched in December 2021, mcs
0.2.3 is the newest model. Extra details about mcs
will be discovered within the introduction weblog.