Search in sources :

Example 6 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, Closure closure) {
    RemoteRepository repository = createRepository(properties, closure);
    setSnapshotRepository(repository);
    return repository;
}
Also used : RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository)

Example 7 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, Closure closure) {
    RemoteRepository repository = new MavenRemoteRepository();
    ConfigureUtil.configureByMap(properties, repository);
    // Should be using ConfigureUtil (with DELEGATE_FIRST strategy), however for backwards compatibility need to use OWNER_FIRST
    new ClosureBackedAction<RemoteRepository>(closure, Closure.OWNER_FIRST).execute(repository);
    return repository;
}
Also used : RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository)

Example 8 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) {
    RemoteRepository repository = createRepository(properties);
    setRepository(repository);
    return repository;
}
Also used : RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository)

Example 9 with RemoteRepository

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

the class MavenRemotePublisher method createMavenRemoteRepository.

private RemoteRepository createMavenRemoteRepository(MavenArtifactRepository repository) {
    RemoteRepository remoteRepository = new RemoteRepository();
    remoteRepository.setUrl(repository.getUrl().toString());
    return remoteRepository;
}
Also used : RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository)

Example 10 with RemoteRepository

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

the class MavenDeployAction method publishArtifacts.

@Override
protected void publishArtifacts(Collection<Artifact> artifacts, RepositorySystem repositorySystem, RepositorySystemSession session) throws DeploymentException {
    RemoteRepository gradleRepo = remoteRepository;
    if (artifacts.iterator().next().isSnapshot() && remoteSnapshotRepository != null) {
        gradleRepo = remoteSnapshotRepository;
    }
    if (gradleRepo == null) {
        throw new GradleException("Must specify a repository for deployment");
    }
    org.sonatype.aether.repository.RemoteRepository aetherRepo = createRepository(gradleRepo);
    DeployRequest request = new DeployRequest();
    request.setRepository(aetherRepo);
    for (Artifact artifact : artifacts) {
        request.addArtifact(artifact);
    }
    LOGGER.info("Deploying to {}", gradleRepo.getUrl());
    repositorySystem.deploy(session, request);
}
Also used : GradleException(org.gradle.api.GradleException) DeployRequest(org.sonatype.aether.deployment.DeployRequest) RemoteRepository(org.apache.maven.artifact.ant.RemoteRepository) Artifact(org.sonatype.aether.artifact.Artifact)

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