当前位置: 首页>>代码示例>>Java>>正文


Java DeployRequest类代码示例

本文整理汇总了Java中org.eclipse.aether.deployment.DeployRequest的典型用法代码示例。如果您正苦于以下问题:Java DeployRequest类的具体用法?Java DeployRequest怎么用?Java DeployRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DeployRequest类属于org.eclipse.aether.deployment包,在下文中一共展示了DeployRequest类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:FileSystemArtifactRepository.java

示例2: publish

import org.eclipse.aether.deployment.DeployRequest; //导入依赖的package包/类
/**
 * @param toPublish each {@link Artifact} must contain a file, that will be published under maven
 *     coordinates in the corresponding {@link Artifact}.
 * @see Artifact#setFile
 */
public DeployResult publish(List<Artifact> toPublish) throws DeploymentException {
  RepositorySystem repoSys =
      Preconditions.checkNotNull(locator.getService(RepositorySystem.class));

  DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
  session.setLocalRepositoryManager(repoSys.newLocalRepositoryManager(session, localRepo));
  session.setReadOnly();

  DeployRequest deployRequest = createDeployRequest(toPublish);

  if (dryRun) {
    return new DeployResult(deployRequest)
        .setArtifacts(toPublish)
        .setMetadata(deployRequest.getMetadata());
  } else {
    return repoSys.deploy(session, deployRequest);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:24,代码来源:Publisher.java

示例3: 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();
}
 
开发者ID:shillner,项目名称:unleash-maven-plugin,代码行数:15,代码来源:ArtifactDeployer.java

示例4: 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
}
 
开发者ID:eclipse,项目名称:packagedrone,代码行数:41,代码来源:MavenTest.java

示例5: 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;
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:10,代码来源:MavenDeployer.java

示例6: 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
}
 
开发者ID:ctron,项目名称:package-drone,代码行数:41,代码来源:MavenTest.java

示例7: afterSessionEnd

import org.eclipse.aether.deployment.DeployRequest; //导入依赖的package包/类
@Override
public void afterSessionEnd(MavenSession session) throws MavenExecutionException {
  boolean errors = !session.getResult().getExceptions().isEmpty();

  if (!deployAtEndRequests.isEmpty()) {

    log.info("");
    log.info("------------------------------------------------------------------------");

    if (errors) {
      log.info("-- Not performing deploy at end due to errors                         --");
    } else {
      log.info("-- Performing deploy at end                                           --");
      log.info("------------------------------------------------------------------------");

      synchronized (deployAtEndRequests) {
        for (DeployRequest deployRequest : deployAtEndRequests) {
          try {
            deploy(session.getRepositorySession(), deployRequest);
          } catch (DeploymentException e) {
            log.error(e.getMessage(), e);
            throw new MavenExecutionException(e.getMessage(), e);
          }
        }
        deployAtEndRequests.clear();
      }
    }

    log.info("------------------------------------------------------------------------");
  }
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:32,代码来源:DeployParticipant.java

示例8: createDeployRequest

import org.eclipse.aether.deployment.DeployRequest; //导入依赖的package包/类
private DeployRequest createDeployRequest(List<Artifact> toPublish) {
  DeployRequest deployRequest = new DeployRequest().setRepository(remoteRepo);
  for (Artifact artifact : toPublish) {
    File file = artifact.getFile();
    Preconditions.checkNotNull(file);
    Preconditions.checkArgument(file.exists(), "No such file: %s", file.getAbsolutePath());

    deployRequest.addArtifact(artifact);
  }
  return deployRequest;
}
 
开发者ID:facebook,项目名称:buck,代码行数:12,代码来源:Publisher.java

示例9: 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);
		}	

	}		
}
 
开发者ID:isomorphic-software,项目名称:isc-maven-plugin,代码行数:34,代码来源:DeployMojo.java

示例10: publishToRepository

import org.eclipse.aether.deployment.DeployRequest; //导入依赖的package包/类
private void publishToRepository(RepositorySystem system, RepositorySystemSession session,
        ArtifactSource source, Manifest manifest, Artifact zip, Artifact pom, Artifact metadata,
        org.eclipse.aether.repository.RemoteRepository deployRepository) {
    String artifactUrl = new ProgressReportingOperationRunner<String>(
            String.format("Publishing archive into repository %s", deployRepository.getId()))
                    .run(indicator -> {
                        String[] url = new String[1];
                        ((DefaultRepositorySystemSession) session).setTransferListener(
                                new ProgressReportingTransferListener(indicator, false) {

                                    @Override
                                    public void transferSucceeded(TransferEvent event) {
                                        super.transferSucceeded(event);
                                        if (event.getResource().getResourceName()
                                                .endsWith(".zip")) {
                                            url[0] = event.getResource().getRepositoryUrl()
                                                    + event.getResource().getResourceName();
                                        }
                                    }
                                });

                        DeployRequest deployRequest = new DeployRequest();
                        deployRequest.addArtifact(zip).addArtifact(pom).addArtifact(metadata);
                        deployRequest.setRepository(deployRepository);

                        system.deploy(session, deployRequest);

                        return url[0];
                    });

    log.newline();
    log.info(Style.cyan(Constants.DIVIDER) + " " + Style.bold("Archive"));
    log.info("  %s (%s in %s files)", Style.underline(FileUtils.relativize(zip.getFile())),
            FileUtils.sizeOf(zip.getFile()), source.allFiles().size());

    printTree(source);

    log.newline();
    log.info(Style.cyan(Constants.DIVIDER) + " " + Style.bold("URL"));
    log.info("  %s", Style.underline(artifactUrl));

    log.newline();
    log.info(Style.green("Successfully published archive for %s:%s (%s)", manifest.group(),
            manifest.artifact(), manifest.version()));
}
 
开发者ID:atomist-attic,项目名称:rug-cli,代码行数:46,代码来源:PublishCommand.java

示例11: getDeployAtEndRequests

import org.eclipse.aether.deployment.DeployRequest; //导入依赖的package包/类
List<DeployRequest> getDeployAtEndRequests() {
  return Collections.unmodifiableList(deployAtEndRequests);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:4,代码来源:DeployParticipant.java

示例12: deploy

import org.eclipse.aether.deployment.DeployRequest; //导入依赖的package包/类
public void deploy(RepositorySystemSession session, DeployRequest deployRequest) throws DeploymentException {
  repoSystem.deploy(session, deployRequest);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:4,代码来源:DeployParticipant.java

示例13: deployAtEnd

import org.eclipse.aether.deployment.DeployRequest; //导入依赖的package包/类
public void deployAtEnd(DeployRequest deployRequest) {
  checkSupport();
  deployAtEndRequests.add(deployRequest);
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:5,代码来源:DeployParticipant.java


注:本文中的org.eclipse.aether.deployment.DeployRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。