public static boolean hasDependency(MavenProject project,String groupId){
  Set<Artifact> artifacts=project.getArtifacts();
  if (artifacts != null) {
    for (    Artifact artifact : artifacts) {
      String scope=artifact.getScope();
      if (Objects.equal("test",scope)) {
        continue;
      }
      if (Objects.equal(groupId,artifact.getGroupId())) {
        return true;
      }
    }
  }
  return false;
}

public static boolean hasDependency ( MavenProject project , String groupId ) { Set < Artifact > artifacts = project . getArtifacts ( ) ; if ( artifacts != null ) { for ( Artifact artifact : artifacts ) { String scope = artifact . getScope ( ) ; if ( Objects . equal ( "test" , scope ) ) { continue ; } if ( Objects . equal ( groupId , artifact . getGroupId ( ) ) ) { return true ; } } } return false ; }
returns true if the maven project has a dependency with the given groupid
