use of org.sonatype.aether.deployment.DeployRequest in project sonatype-aether by sonatype.
the class Aether method deploy.
public void deploy(Artifact artifact, Artifact pom, String remoteRepository) throws DeploymentException {
RepositorySystemSession session = newSession();
RemoteRepository nexus = new RemoteRepository("nexus", "default", remoteRepository);
Authentication authentication = new Authentication("admin", "admin123");
nexus.setAuthentication(authentication);
DeployRequest deployRequest = new DeployRequest();
deployRequest.addArtifact(artifact).addArtifact(pom);
deployRequest.setRepository(nexus);
repositorySystem.deploy(session, deployRequest);
}
use of org.sonatype.aether.deployment.DeployRequest in project sonatype-aether by sonatype.
the class DeployArtifacts method main.
public static void main(String[] args) throws Exception {
System.out.println("------------------------------------------------------------");
System.out.println(DeployArtifacts.class.getSimpleName());
RepositorySystem system = Booter.newRepositorySystem();
RepositorySystemSession session = Booter.newRepositorySystemSession(system);
Artifact jarArtifact = new DefaultArtifact("test", "demo", "", "jar", "0.1-SNAPSHOT");
jarArtifact = jarArtifact.setFile(new File("demo.jar"));
Artifact pomArtifact = new SubArtifact(jarArtifact, "", "pom");
pomArtifact = pomArtifact.setFile(new File("pom.xml"));
RemoteRepository distRepo = new RemoteRepository("demo", "default", new File("target/dist-repo").toURI().toString());
DeployRequest deployRequest = new DeployRequest();
deployRequest.addArtifact(jarArtifact).addArtifact(pomArtifact);
deployRequest.setRepository(distRepo);
system.deploy(session, deployRequest);
}
use of org.sonatype.aether.deployment.DeployRequest 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);
}
use of org.sonatype.aether.deployment.DeployRequest in project sonatype-aether by sonatype.
the class DefaultDeployerTest method setup.
@Before
public void setup() throws IOException {
artifact = new DefaultArtifact("gid", "aid", "jar", "ver");
artifact = artifact.setFile(TestFileUtils.createTempFile("artifact"));
metadata = new DefaultMetadata("gid", "aid", "ver", "type", Nature.RELEASE_OR_SNAPSHOT, TestFileUtils.createTempFile("metadata"));
session = new TestRepositorySystemSession();
manager = new StubRemoteRepositoryManager();
deployer = new DefaultDeployer();
deployer.setRemoteRepositoryManager(manager);
deployer.setRepositoryEventDispatcher(new StubRepositoryEventDispatcher());
UpdateCheckManager updateCheckManager = new StaticUpdateCheckManager(true);
deployer.setUpdateCheckManager(updateCheckManager);
deployer.setFileProcessor(TestFileProcessor.INSTANCE);
deployer.setSyncContextFactory(new StubSyncContextFactory());
request = new DeployRequest();
request.setRepository(new RemoteRepository("id", "default", "file:///"));
connector = new RecordingRepositoryConnector();
manager.setConnector(connector);
listener = new RecordingRepositoryListener();
session.setRepositoryListener(listener);
}
Aggregations