Example usage for org.apache.maven.repository.metadata ArtifactMetadata setVersion

List of usage examples for org.apache.maven.repository.metadata ArtifactMetadata setVersion

Introduction

In this page you can find the example usage for org.apache.maven.repository.metadata ArtifactMetadata setVersion.

Prototype

public void setVersion(String version) 

Source Link

Usage

From source file:org.ebayopensource.turmeric.eclipse.maven.core.utils.MavenCoreUtils.java

License:Open Source License

/**
 * Gets the library identifier.// w ww .jav a  2s  . c  o  m
 *
 * @param libName the lib name
 * @return the library identifier
 * @throws MavenEclipseApiException the maven eclipse api exception
 */
public static ArtifactMetadata getLibraryIdentifier(final String libName) throws MavenEclipseApiException {
    ArtifactMetadata result = null;
    if (SOALogger.DEBUG)
        logger.entering(libName);
    try {
        result = MavenEclipseUtil.artifactMetadata(libName);
        if (result == null || result.getGroupId() == null || result.getArtifactId() == null)
            return null;
        if (StringUtils.isBlank(result.getVersion())) {
            Artifact artifact = getLatestArtifact(result.getGroupId(), result.getArtifactId());
            if (artifact != null) {
                result.setVersion(artifact.getVersion());
            }
        }
        return result;
    } finally {
        if (SOALogger.DEBUG)
            logger.exiting(result);
    }
}