Java 类org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository 实例源码

项目:gradle-lazy-credentials    文件:LazyCredentialsExtension.java   
@Override
public LazyCredentialsExtension configure(Closure c) {
    if (!Closure.class.isInstance(c.getDelegate()) ||
        DefaultMavenArtifactRepository.class.isInstance(((Closure)c.getDelegate()))) {
        throw new IllegalStateException("This extension can only be used in maven repository config.");
    }

    LazyCredentials credentials = new LazyCredentials(project);

    Object originalDelegate = ((Closure)c.getDelegate()).getDelegate();
    c.setResolveStrategy(Closure.DELEGATE_FIRST);
    c.setDelegate(credentials);
    c.call();

    ((DefaultMavenArtifactRepository) originalDelegate).setConfiguredCredentials(credentials);
    return this;
}
项目:gradle-mobile-plugin    文件:XdepsUtil.java   
public static List<DefaultMavenArtifactRepository> getMavenRepositories(Project project) {
    List<DefaultMavenArtifactRepository> repos = new ArrayList<>();
    PublishingExtension publishingExtension = getPublishingExtension(project);
    if (publishingExtension != null) {
        RepositoryHandler repositoryHandler = publishingExtension.getRepositories();
        for (ArtifactRepository repo : repositoryHandler) {
            repos.add((DefaultMavenArtifactRepository)repo);
        }
    }
    return repos;
}
项目:gradle-mobile-plugin    文件:XdepsUtil.java   
public static boolean hasMavenRepository(Project project, String repoName) {
    for (DefaultMavenArtifactRepository repo : getMavenRepositories(project)) {
        if (repoName.equals(repo.getName())) {
            return true;
        }
    }
    return false;
}