code: protected String getCurrentProjectVersion() throws MojoFailureException {
          final Model model = readModel(mavenSession.getCurrentProject());
          if (model.getVersion() == null) {
              throw new MojoFailureException(
                      "Cannot get current project version. This plugin should be executed from the parent project.");
          }
          return model.getVersion();
      }
docs: Gets current project version from pom.xml file.
  
  @return Current project version.
  @throws MojoFailureException