static CompositeImageName create(final String imageName, final List<String> imageTags)
      throws MojoExecutionException {

    final boolean containsTag = containsTag(imageName);

    final String name = containsTag ? StringUtils.substringBeforeLast(imageName, ":") : imageName;
    if (StringUtils.isBlank(name)) {
      throw new MojoExecutionException("imageName not set!");
    }

    final List<String> tags = new ArrayList<>();
    final String tag = containsTag ? StringUtils.substringAfterLast(imageName, ":") : "";
    if (StringUtils.isNotBlank(tag)) {
      tags.add(tag);
    }
    if (imageTags != null) {
      tags.addAll(imageTags);
    }
    if (tags.size() == 0) {
      throw new MojoExecutionException("No tag included in imageName and no imageTags set!");
    }
    return new CompositeImageName(name, tags);
  }
An image name can be a plain image name or in the composite format &lt;name&gt;:&lt;tag&gt; and
this factory method makes sure that we get the plain image name as well as all the desired tags
for an image, including any composite tag.

@param imageName Image name.
@param imageTags List of image tags.
@return {@link CompositeImageName}
@throws MojoExecutionException
src/main/java/com/spotify/docker/CompositeImageName.java