@Nullable
  @VisibleForTesting
  Server getServerFromMavenSettings(String registry) {
    Server server = settings.getServer(registry);
    if (server != null) {
      return server;
    }

    // try without port
    int index = registry.lastIndexOf(':');
    if (index != -1) {
      return settings.getServer(registry.substring(0, index));
    }
    return null;
  }
Retrieves credentials for {@code registry} from Maven settings.

@param registry the registry
@return the auth info for the registry, or {@link Optional#empty} if none could be retrieved
jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/MavenSettingsServerCredentials.java