private static @Nullable String extractVersionFromArtifactName(@NotNull String artifactName, @NotNull String packageName) {
    final String withoutExtension;
    // Contains more than one dot and thus should be handled separately
    if (artifactName.endsWith(".tar.gz")) {
      withoutExtension = StringUtil.trimEnd(artifactName, ".tar.gz");
    }
    else {
      withoutExtension = FileUtilRt.getNameWithoutExtension(artifactName);
    }
    final String packageNameWithUnderscores = packageName.replace('-', '_');
    final String suffix;
    if (StringUtil.startsWithIgnoreCase(withoutExtension, packageName)) {
      suffix = withoutExtension.substring(packageName.length());
    }
    else if (StringUtil.startsWithIgnoreCase(withoutExtension, packageNameWithUnderscores)) {
      suffix = withoutExtension.substring(packageNameWithUnderscores.length());
    }
    else {
      return null;
    }
    // StringUtil.split excludes empty parts by default effectively stripping a leading dash
    final String version = ContainerUtil.getFirstItem(StringUtil.split(suffix, "-"));
    if (StringUtil.isNotEmpty(version)) {
      return version;
    }
    return null;
  }
private static @Nullable String extractVersionFromArtifactName(@NotNull String artifactName, @NotNull String packageName)