public static String getDependencyVersion(MavenProject project, String groupId, String artifactId) {
    """
	Returns the version associated to the dependency dependency with the given groupId and artifactId (if present)
    """
        Set<Artifact> artifacts = project.getArtifacts();
        if (artifacts != null) {
            for (Artifact artifact : artifacts) {
                String scope = artifact.getScope();
                if (Objects.equal("test", scope)) {
                    continue;
                }
                if (artifactId != null && !Objects.equal(artifactId, artifact.getArtifactId())) {
                    continue;
                }
                if (Objects.equal(groupId, artifact.getGroupId())) {
                    return artifact.getVersion();
                }
            }
        }
        return null;
    }
public static String getDependencyVersion(MavenProject project, String groupId, String artifactId) {
        Set<Artifact> artifacts = project.getArtifacts();
        if (artifacts != null) {
            for (Artifact artifact : artifacts) {
                String scope = artifact.getScope();
                if (Objects.equal("test", scope)) {
                    continue;
                }
                if (artifactId != null && !Objects.equal(artifactId, artifact.getArtifactId())) {
                    continue;
                }
                if (Objects.equal(groupId, artifact.getGroupId())) {
                    return artifact.getVersion();
                }
            }
        }
        return null;
    }
public static String getDependencyVersion ( MavenProject project , String groupId , String artifactId ) { Set < Artifact > artifacts = project . getArtifacts ( ) ; if ( artifacts != null ) { for ( Artifact artifact : artifacts ) { String scope = artifact . getScope ( ) ; if ( Objects . equal ( "test" , scope ) ) { continue ; } if ( artifactId != null && ! Objects . equal ( artifactId , artifact . getArtifactId ( ) ) ) { continue ; } if ( Objects . equal ( groupId , artifact . getGroupId ( ) ) ) { return artifact . getVersion ( ) ; } } } return null ; }
Returns the version associated to the dependency dependency with the given groupId and artifactId (if present)
Returns the version associated to the dependency dependency with the given groupId and artifactId ( if present )