code: public static boolean ensureMavenDependencyAdded(Project project, DependencyInstaller dependencyInstaller, String groupId, String artifactId, String scope) {
          List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
          for (Dependency d : dependencies) {
              if (groupId.equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) {
                  getLOG().debug("Project already includes:  " + groupId + ":" + artifactId + " for version: " + d.getCoordinate().getVersion());
                  return false;
              }
          }
  
          DependencyBuilder component = DependencyBuilder.create().
                  setGroupId(groupId).
                  setArtifactId(artifactId);
  
          if (scope != null) {
              component.setScopeType(scope);
          }
  
          String version = MavenHelpers.getVersion(groupId, artifactId);
          if (Strings.isNotBlank(version)) {
              component = component.setVersion(version);
              getLOG().debug("Adding pom.xml dependency:  " + groupId + ":" + artifactId + " version: " + version + " scope: " + scope);
          } else {
              getLOG().debug("No version could be found for:  " + groupId + ":" + artifactId);
          }
          dependencyInstaller.install(project, component);
          return true;
      }
docs: Returns true if the dependency was added or false if its already there