Search in sources :

Example 1 with RemoteRepository

use of org.apache.maven.artifact.ant.RemoteRepository in project robolectric by robolectric.

the class MavenDependencyResolverTest method getLocalArtifactUrl_shouldAddConfiguredRemoteRepository.

@Test
public void getLocalArtifactUrl_shouldAddConfiguredRemoteRepository() {
    DependencyResolver dependencyResolver = createResolver();
    DependencyJar dependencyJar = new DependencyJar("group1", "artifact1", "", null);
    dependencyResolver.getLocalArtifactUrl(dependencyJar);
    List<RemoteRepository> repositories = dependenciesTask.getRemoteRepositories();
    assertEquals(1, repositories.size());
    RemoteRepository remoteRepository = repositories.get(0);
    assertEquals(REPOSITORY_URL, remoteRepository.getUrl());
    assertEquals(REPOSITORY_ID, remoteRepository.getId());
}
Also used : RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository) Test(org.junit.Test)

Example 2 with RemoteRepository

use of org.apache.maven.artifact.ant.RemoteRepository in project gradle by gradle.

the class MavenDeployAction method createRepository.

private org.sonatype.aether.repository.RemoteRepository createRepository(RemoteRepository gradleRepo) {
    org.sonatype.aether.repository.RemoteRepository repo = new org.sonatype.aether.repository.RemoteRepository("remote", gradleRepo.getLayout(), gradleRepo.getUrl());
    org.apache.maven.artifact.ant.Authentication auth = gradleRepo.getAuthentication();
    if (auth != null) {
        repo.setAuthentication(new Authentication(auth.getUserName(), auth.getPassword(), auth.getPrivateKey(), auth.getPassphrase()));
    }
    org.apache.maven.artifact.ant.Proxy proxy = gradleRepo.getProxy();
    if (proxy != null) {
        DefaultProxySelector proxySelector = new DefaultProxySelector();
        Authentication proxyAuth = new Authentication(proxy.getUserName(), proxy.getPassword());
        proxySelector.add(new Proxy(proxy.getType(), proxy.getHost(), proxy.getPort(), proxyAuth), proxy.getNonProxyHosts());
        repo.setProxy(proxySelector.getProxy(repo));
    }
    return repo;
}
Also used : DefaultProxySelector(org.sonatype.aether.util.repository.DefaultProxySelector) RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository) Proxy(org.sonatype.aether.repository.Proxy) Authentication(org.sonatype.aether.repository.Authentication)

Example 3 with RemoteRepository

use of org.apache.maven.artifact.ant.RemoteRepository in project gradle by gradle.

the class DefaultGroovyMavenDeployer method createRepository.

private RemoteRepository createRepository(Map properties) {
    RemoteRepository repository = new MavenRemoteRepository();
    ConfigureUtil.configureByMap(properties, repository);
    return repository;
}
Also used : RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository)

Example 4 with RemoteRepository

use of org.apache.maven.artifact.ant.RemoteRepository in project gradle by gradle.

the class DefaultGroovyMavenDeployer method snapshotRepository.

public RemoteRepository snapshotRepository(Map properties) {
    RemoteRepository repository = createRepository(properties);
    setSnapshotRepository(repository);
    return repository;
}
Also used : RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository)

Example 5 with RemoteRepository

use of org.apache.maven.artifact.ant.RemoteRepository in project gradle by gradle.

the class DefaultGroovyMavenDeployer method repository.

public RemoteRepository repository(Map properties, Closure closure) {
    RemoteRepository repository = createRepository(properties, closure);
    setRepository(repository);
    return repository;
}
Also used : RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository)

Aggregations

RemoteRepository (org.apache.maven.artifact.ant.RemoteRepository)11 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 DependenciesTask (org.apache.maven.artifact.ant.DependenciesTask)1 Dependency (org.apache.maven.model.Dependency)1 GradleException (org.gradle.api.GradleException)1 Test (org.junit.Test)1 Artifact (org.sonatype.aether.artifact.Artifact)1 DeployRequest (org.sonatype.aether.deployment.DeployRequest)1 Authentication (org.sonatype.aether.repository.Authentication)1 Proxy (org.sonatype.aether.repository.Proxy)1 DefaultProxySelector (org.sonatype.aether.util.repository.DefaultProxySelector)1