code: private String getVersion(final Class launcherClass, final String groupId, final String artifactId) throws NotAvailableException {
          String version = null;
  
          // try to load from maven properties first
          try {
              Properties p = new Properties();
              InputStream is = getClass().getResourceAsStream("/META-INF/maven/"+groupId+"/"+artifactId+"/pom.properties");
              if (is != null) {
                  p.load(is);
                  version = p.getProperty("version", "");
              }
          } catch (Exception e) {
              // ignore
          }
  
          // fallback to using Java API
          if (version == null) {
              Package launcherPackage = launcherClass.getClass().getPackage();
              if (launcherPackage != null) {
                  version = launcherPackage.getImplementationVersion();
                  if (version == null) {
                      version = launcherPackage.getSpecificationVersion();
                  }
              }
          }
  
          if (version == null) {
              // we could not compute the version so  a blank
              throw new NotAvailableException("Application Version");
          }
  
          return version;
      }
docs: Method tries to detect the application Version.
  @param launcherClass the launcher to extract the class path.
  @param groupId the group id of the application.
  @param artifactId the artifact id of the application.
  @return the semantic version of the application is returned.
  @throws NotAvailableException is thrown if the version could not be detected.