code: public static Version fromClasspathProperties(@Nonnull Class<?> clazz, String path, String propertyName, String gitPath, String gitPropertyName, Version defaultVersion) {
          try {
              final URL resource = getResource(clazz, path);
              final Properties versionProperties = new Properties();
              versionProperties.load(resource.openStream());
  
              final com.github.zafarkhaja.semver.Version version = com.github.zafarkhaja.semver.Version.valueOf(versionProperties.getProperty(propertyName));
              final int major = version.getMajorVersion();
              final int minor = version.getMinorVersion();
              final int patch = version.getPatchVersion();
              final String qualifier = version.getPreReleaseVersion();
  
              String commitSha = null;
              try {
                  final Properties git = new Properties();
                  final URL gitResource = getResource(clazz, gitPath);
                  git.load(gitResource.openStream());
                  commitSha = git.getProperty(gitPropertyName);
                  // abbreviate if present and looks like a long sha
                  if (commitSha != null && commitSha.length() > 7) {
                      commitSha = commitSha.substring(0, 7);
                  }
              } catch (Exception e) {
                  LOG.debug("Git commit details are not available, skipping.", e);
              }
  
              return from(major, minor, patch, qualifier, commitSha);
          } catch (Exception e) {
              LOG.error("Unable to read " + path + ", this build has no version number.", e);
          }
          return defaultVersion;
      }
docs: Try to read the version from {@code path} ({@code propertyName} property)
  and {@code gitPath} ({@code gitPropertyName} property) from the classpath.
  
  @param clazz           Class where the class loader should be obtained from.
  @param path            Path of the properties file on the classpath which contains the version information.
  @param propertyName    The name of the property to read as project version ("major.minor.patch-preReleaseVersion").
  @param gitPath         Path of the properties file on the classpath which contains the SCM information.
  @param gitPropertyName The name of the property to read as git commit SHA.
  @param defaultVersion  The {@link Version} to return if reading the information from the properties files failed.