moby-names-generator-java
Java Version of the famous Moby (Docker) Names Generator.
import info.schnatterer.mobynamesgenerator.MobyNamesGenerator;
class GenerateMobyName {
public static void main(String[] args) {
System.out.println(MobyNamesGenerator.getRandomName());
}
}
Also available as CLI.
Usage
Add the latest stable version of moby-names-generator to the dependency management tool of your choice.
<dependency>
<groupId>info.schnatterer.moby-names-generator</groupId>
<artifactId>moby-names-generator</artifactId>
<version>20.10.0-r0</version>
</dependency>
You can also get snapshot versions from our snapshot repository (for the most recent commit). To do so, add the following repo to your pom.xml
or settings.xml
:
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
Demo/CLI
There are examples for Java 8 and Java9+ (using Jigsaw/JPMS). Both implement simple command line interfaces that return a random name.
The Java 9+ example is also available as compact Docker image, built using GraalVM.
$ docker run --rm schnatterer/moby-names-generator
nifty_noether
Releasing
The version name looks like so, for example: 20.10.0-r0-SNAPSHOT
The first part (before -r0
) corresponds to the moby version. The second part r0
is zero-based and can be increase when the moby version does not change. When updating the moby version, use a snapshot first, to see if the builds still succeeds.
- Set the version using:
mvn versions:set
- When the builds succeed, release either via
./mvnw release:prepare -Darguments=pgp.skip=true
Sets versions in pom.xml, commits, tags and pushes to SCM. Travis builds tag and pushes to Maven Central.- Or manually using
mvn versions:set
to set version withoutSNAPSHOT
, then increaser
and addSNAPSHOT
again. Don't forget to tag. Either locally or via GitHub (signed tag!)