本文整理汇总了Java中org.eclipse.aether.deployment.DeployRequest.setRepository方法的典型用法代码示例。如果您正苦于以下问题:Java DeployRequest.setRepository方法的具体用法?Java DeployRequest.setRepository怎么用?Java DeployRequest.setRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.aether.deployment.DeployRequest
的用法示例。
在下文中一共展示了DeployRequest.setRepository方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.eclipse.aether.deployment.DeployRequest; //导入方法依赖的package包/类
@Override
public void deploy(final String pom,
final Artifact... artifacts) {
try {
final DeployRequest deployRequest = new DeployRequest();
for (Artifact artifact : artifacts) {
deployRequest.addArtifact(artifact);
}
deployRequest.setRepository(getRepository());
Aether.getAether().getSystem().deploy(Aether.getAether().getSession(),
deployRequest);
} catch (DeploymentException e) {
throw new RuntimeException(e);
}
}
示例2: deployArtifacts
import org.eclipse.aether.deployment.DeployRequest; //导入方法依赖的package包/类
/**
* Deploys the given artifacts to the configured remote Maven repositories.
*
* @param artifacts the artifacts to deploy.
* @return the artifacts that have been deployed successfully.
* @throws DeploymentException if anything goes wrong during the deployment process.
*/
public Collection<Artifact> deployArtifacts(Collection<Artifact> artifacts) throws DeploymentException {
DeployRequest request = new DeployRequest();
request.setArtifacts(artifacts);
request.setRepository(this.metadata.getDeploymentRepository());
DeployResult result = this.deployer.deploy(this.repoSession, request);
return result.getArtifacts();
}
示例3: testMvn1
import org.eclipse.aether.deployment.DeployRequest; //导入方法依赖的package包/类
@Test
public void testMvn1 () throws Exception
{
final ChannelTester ct = ChannelTester.create ( getWebContext (), "m1" );
ct.addAspect ( "mvn" );
ct.addAspect ( "maven.repo" );
ct.assignDeployGroup ( "m1" );
final String key = ct.getDeployKeys ().iterator ().next (); // get first
assertNotNull ( key );
final RepositorySystem system = MavenUtil.newRepositorySystem ();
final RepositorySystemSession session = MavenUtil.newRepositorySystemSession ( system );
Artifact jarArtifact = new DefaultArtifact ( "org.eclipse.packagedrone.testing", "test.felix1", "", "jar", "0.0.1-SNAPSHOT" );
jarArtifact = jarArtifact.setFile ( new File ( TEST_1_JAR ) );
Artifact pomArtifact = new SubArtifact ( jarArtifact, "", "pom" );
pomArtifact = pomArtifact.setFile ( new File ( TEST_1_POM ) );
Artifact srcArtifact = new SubArtifact ( jarArtifact, "sources", "jar" );
srcArtifact = srcArtifact.setFile ( new File ( TEST_1_SOURCES_JAR ) );
final AuthenticationBuilder ab = new AuthenticationBuilder ();
ab.addUsername ( "deploy" );
ab.addPassword ( key );
final Authentication auth = ab.build ();
final RemoteRepository distRepo = new RemoteRepository.Builder ( "test", "default", resolve ( String.format ( "/maven/%s", ct.getId () ) ) ).setAuthentication ( auth ).build ();
final DeployRequest deployRequest = new DeployRequest ();
deployRequest.addArtifact ( jarArtifact ).addArtifact ( pomArtifact ).addArtifact ( srcArtifact );
deployRequest.setRepository ( distRepo );
system.deploy ( session, deployRequest );
testUrl ( String.format ( "/maven/%s", ct.getId () ) ); // index page
// FIXME: check more data
}
示例4: deployUsingAether
import org.eclipse.aether.deployment.DeployRequest; //导入方法依赖的package包/类
private DeployResult deployUsingAether(Artifact artifact, Artifact pom, RemoteRepository deploymentRepository) throws DeploymentException {
RepositorySystem system = aetherConfigurer.newRepositorySystem();
RepositorySystemSession session = aetherConfigurer.newSession(system, mvnConsumerConfigurer.getLocalM2Repo());
DeployRequest deployRequest = new DeployRequest();
deployRequest.addArtifact(artifact).addArtifact(pom);
deployRequest.setRepository(deploymentRepository);
DeployResult result = system.deploy(session, deployRequest);
return result;
}
示例5: testMvn1
import org.eclipse.aether.deployment.DeployRequest; //导入方法依赖的package包/类
@Test
public void testMvn1 () throws Exception
{
final ChannelTester ct = ChannelTester.create ( getWebContext (), "m1" );
ct.addAspect ( "mvn" );
ct.addAspect ( "maven.repo" );
ct.assignDeployGroup ( "m1" );
final String key = ct.getDeployKeys ().iterator ().next (); // get first
assertNotNull ( key );
final RepositorySystem system = MavenUtil.newRepositorySystem ();
final RepositorySystemSession session = MavenUtil.newRepositorySystemSession ( system );
Artifact jarArtifact = new DefaultArtifact ( "de.dentrassi", "test.bundle1", "", "jar", "1.0.0-SNAPSHOT" );
jarArtifact = jarArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT.jar" ) );
Artifact pomArtifact = new SubArtifact ( jarArtifact, "", "pom" );
pomArtifact = pomArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT.pom" ) );
Artifact srcArtifact = new SubArtifact ( jarArtifact, "sources", "jar" );
srcArtifact = srcArtifact.setFile ( new File ( "data/mvn/test.bundle1-1.0.0-SNAPSHOT-sources.jar" ) );
final AuthenticationBuilder ab = new AuthenticationBuilder ();
ab.addUsername ( "deploy" );
ab.addPassword ( key );
final Authentication auth = ab.build ();
final RemoteRepository distRepo = new RemoteRepository.Builder ( "test", "default", resolve ( String.format ( "/maven/%s", ct.getId () ) ) ).setAuthentication ( auth ).build ();
final DeployRequest deployRequest = new DeployRequest ();
deployRequest.addArtifact ( jarArtifact ).addArtifact ( pomArtifact ).addArtifact ( srcArtifact );
deployRequest.setRepository ( distRepo );
system.deploy ( session, deployRequest );
testUrl ( String.format ( "/maven/%s", ct.getId () ) ); // index page
// FIXME: check more data
}
示例6: doExecute
import org.eclipse.aether.deployment.DeployRequest; //导入方法依赖的package包/类
/**
* Deploy each of the provided {@link Module}s, along with their SubArtifacts (POMs, JavaDoc bundle, etc.), to the repository location
* indicated by {@link #repositoryUrl}.
*/
@Override
public void doExecute(Set<Module> artifacts) throws MojoExecutionException, MojoFailureException {
RemoteRepository.Builder builder = new RemoteRepository.Builder(repositoryId, repositoryType, repositoryUrl);
Authentication authentication = getAuthentication(repositoryId);
builder.setAuthentication(authentication);
LOGGER.info("Deploying to repositoryId '{}' with credentials: {}", repositoryId, authentication == null ? null : authentication.toString());
RemoteRepository repository = builder.build();
for (Module artifact : artifacts) {
DeployRequest deployRequest = new DeployRequest();
deployRequest.addArtifact(artifact);
deployRequest.setRepository(repository);
for (Artifact subArtifact : artifact.getAttachments()) {
deployRequest.addArtifact(subArtifact);
}
try {
repositorySystem.deploy(repositorySystemSession, deployRequest);
} catch (DeploymentException e) {
throw new MojoFailureException("Deployment failed: ", e);
}
}
}