All Downloads are FREE. Search and download functionalities are using the official Maven repository.

netflix.nebula.dependency.recommender.provider.RecommendationResolver Maven / Gradle / Ivy

Go to download

Allows projects to leave off version numbers in dependencies section and have versions recommended by other sources

The newest version!
package netflix.nebula.dependency.recommender.provider;

import netflix.nebula.dependency.recommender.ModuleNotationParser;
import org.gradle.api.Project;
import org.gradle.api.artifacts.ModuleVersionIdentifier;

public class RecommendationResolver {
    Project project;

    public RecommendationResolver(Project project) {
        this.project = project;
    }

    public String recommend(String dependencyNotation, String recommenderName) throws Exception {
        ModuleVersionIdentifier mvid = ModuleNotationParser.parse(dependencyNotation);

        String version = mvid.getVersion() != null ? mvid.getVersion() :
                project.getExtensions().findByType(RecommendationProviderContainer.class).getByName(recommenderName)
                    .getVersion(mvid.getGroup(), mvid.getName());

        return mvid.getGroup() + ":" + mvid.getName() + ":" + version;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy