當前位置: 首頁>>代碼示例>>Java>>正文


Java ArtifactRequest.setRepositories方法代碼示例

本文整理匯總了Java中org.eclipse.aether.resolution.ArtifactRequest.setRepositories方法的典型用法代碼示例。如果您正苦於以下問題:Java ArtifactRequest.setRepositories方法的具體用法?Java ArtifactRequest.setRepositories怎麽用?Java ArtifactRequest.setRepositories使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.aether.resolution.ArtifactRequest的用法示例。


在下文中一共展示了ArtifactRequest.setRepositories方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: load

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
@Override
public Optional<ArtifactResult> load(ArtifactCoordinates coordinates) throws Exception {
  Artifact artifact = new DefaultArtifact(coordinates.toString());

  ArtifactRequest artifactRequest = new ArtifactRequest();
  artifactRequest.setArtifact(artifact);
  artifactRequest.setRepositories(this.remoteProjectRepos);

  ArtifactResult artifactResult;
  try {
    artifactResult = this.repoSystem.resolveArtifact(this.repoSession, artifactRequest);
  } catch (ArtifactResolutionException e) {
    // must not throw the error or log as an error since this is an expected behavior
    artifactResult = null;
  }

  return Optional.fromNullable(artifactResult);
}
 
開發者ID:shillner,項目名稱:unleash-maven-plugin,代碼行數:19,代碼來源:ArtifactCacheLoader.java

示例2: resolvePluginDependency

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
/**
 * Uses the aether to resolve a plugin dependency and returns the file for further processing.
 *
 * @param d the dependency to resolve.
 * @param pluginRepos the plugin repositories to use for dependency resolution.
 * @param resolver the resolver for aether access.
 * @param repoSystemSession the session for the resolver.
 * @return optionally a file which is the resolved dependency.
 */
public static Optional<File> resolvePluginDependency(Dependency d, List<RemoteRepository> pluginRepos,
    ArtifactResolver resolver, RepositorySystemSession repoSystemSession) {
  Artifact a = new DefaultArtifact(d.getGroupId(), d.getArtifactId(), d.getClassifier(), d.getType(), d.getVersion());
  ArtifactRequest artifactRequest = new ArtifactRequest();
  artifactRequest.setArtifact(a);
  artifactRequest.setRepositories(pluginRepos);
  try {
    ArtifactResult artifactResult = resolver.resolveArtifact(repoSystemSession, artifactRequest);
    if (artifactResult.getArtifact() != null) {
      return Optional.fromNullable(artifactResult.getArtifact().getFile());
    }
    return Optional.absent();
  } catch (ArtifactResolutionException e) {
    return Optional.absent();
  }
}
 
開發者ID:shillner,項目名稱:maven-cdi-plugin-utils,代碼行數:26,代碼來源:MavenUtil.java

示例3: fetchDependency

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
private Path fetchDependency(final String artifactIdentifier) throws MojoExecutionException {
    ArtifactRequest request = new ArtifactRequest();
    final DefaultArtifact artifact = new DefaultArtifact(artifactIdentifier);
    request.setArtifact(artifact);
    request.setRepositories(remoteRepos);

    LogProvider.debug("Resolving artifact " + artifact + " from " + remoteRepos);

    ArtifactResult result;
    try {
        result = repoSystem.resolveArtifact(repoSession, request);
    } catch (ArtifactResolutionException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }

    LogProvider.debug("Resolved artifact " + artifact + " to " + result.getArtifact().getFile() + " from " + result.getRepository());
    return result.getArtifact().getFile().toPath();
}
 
開發者ID:sdaschner,項目名稱:jaxrs-analyzer-maven-plugin,代碼行數:19,代碼來源:JAXRSAnalyzerMojo.java

示例4: get

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
public Path get(@NotNull String groupName, @NotNull String artifactName, @NotNull String version, @NotNull String artifactFileExtension) {
    Artifact artifact = new DefaultArtifact(groupName, artifactName, artifactFileExtension, version);

    RepositorySystem system = newRepositorySystem();
    RepositorySystemSession session = newRepositorySystemSession(system);

    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(artifact);
    request.setRepositories(repositories(system, session));

    try {
        ArtifactResult artifactResult = system.resolveArtifact(session, request);

        artifact = artifactResult.getArtifact();

        Log.info(artifact + " resolved to  " + artifact.getFile());

        return artifact.getFile().toPath();

    } catch (ArtifactResolutionException e) {
        throw new RuntimeException(format("Couldn't resolve a '%s' artifact for '%s:%s:%s'",
                artifactFileExtension, groupName, artifactName, version
        ), e);
    }
}
 
開發者ID:jan-molak,項目名稱:jenkins-build-monitor-plugin,代碼行數:26,代碼來源:ArtifactTransporter.java

示例5: resolve

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
@Override
public File resolve(Object artifact, Log log) {
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact((Artifact) artifact);
    request.setRepositories(projectRepositories);

    log.debug("Resolving artifact " + artifact + " from " + projectRepositories);

    ArtifactResult result;
    try {
        result = repositorySystem.resolveArtifact(repositorySystemSession, request);
    } catch (ArtifactResolutionException e) {
        log.warn("Cound not resolve " + artifact, e);
        return null;
    }

    log.debug("Resolved artifact " + artifact + " to " + result.getArtifact().getFile() + " from " + result.getRepository());

    return result.getArtifact().getFile();
}
 
開發者ID:retog,項目名稱:karaf-maven-plugin,代碼行數:21,代碼來源:Dependency31Helper.java

示例6: resolveById

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
@Override
public File resolveById(String id, Log log) throws MojoFailureException {
    id = MavenUtil.mvnToAether(id);
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(new DefaultArtifact(id));
    request.setRepositories(projectRepositories);

    log.debug("Resolving artifact " + id + " from " + projectRepositories);

    ArtifactResult result;
    try {
        result = repositorySystem.resolveArtifact(repositorySystemSession, request);
    } catch (ArtifactResolutionException e) {
        log.warn("Could not resolve " + id, e);
        throw new MojoFailureException(format("Couldn't resolve artifact %s", id), e);
    }

    log.debug("Resolved artifact " + id + " to " + result.getArtifact().getFile() + " from " + result.getRepository());

    return result.getArtifact().getFile();
}
 
開發者ID:retog,項目名稱:karaf-maven-plugin,代碼行數:22,代碼來源:Dependency31Helper.java

示例7: resolve

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
/**
 * Resolves the specified artifact (using its GAV, classifier and packaging).
 *
 * @param mojo       the mojo
 * @param groupId    the groupId of the artifact to resolve
 * @param artifactId the artifactId of the artifact to resolve
 * @param version    the version
 * @param type       the type
 * @param classifier the classifier
 * @return the artifact's file if it can be revolved. The file is located in the local maven repository.
 * @throws MojoExecutionException if the artifact cannot be resolved
 */
public static File resolve(AbstractWisdomMojo mojo, String groupId, String artifactId, String version,
                           String type, String classifier) throws MojoExecutionException {
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(
            new DefaultArtifact(groupId, artifactId, classifier, type, version));
    request.setRepositories(mojo.remoteRepos);

    mojo.getLog().info("Resolving artifact " + artifactId +
            " from " + mojo.remoteRepos);

    ArtifactResult result;
    try {
        result = mojo.repoSystem.resolveArtifact(mojo.repoSession, request);
    } catch (ArtifactResolutionException e) {
        mojo.getLog().error("Cannot resolve " + groupId + ":" + artifactId + ":" + version + ":" + type);
        throw new MojoExecutionException(e.getMessage(), e);
    }

    mojo.getLog().info("Resolved artifact " + artifactId + " to " +
            result.getArtifact().getFile() + " from "
            + result.getRepository());

    return result.getArtifact().getFile();
}
 
開發者ID:wisdom-framework,項目名稱:wisdom,代碼行數:37,代碼來源:DependencyFinder.java

示例8: resolve

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
@Override
public File resolve(final MavenProject project, final String artifact) {
    final ArtifactResult result;
    try {
        final ProjectBuildingRequest projectBuildingRequest = project.getProjectBuildingRequest();

        final ArtifactRequest request = new ArtifactRequest();
        final ArtifactNameSplitter splitter = ArtifactNameSplitter.of(artifact).split();
        final Artifact defaultArtifact = new DefaultArtifact(splitter.getGroupId(), splitter.getArtifactId(), splitter.getClassifier(), splitter.getPackaging(), splitter.getVersion());
        request.setArtifact(defaultArtifact);
        final List<RemoteRepository> repos = project.getRemoteProjectRepositories();
        request.setRepositories(repos);
        result = repoSystem.resolveArtifact(projectBuildingRequest.getRepositorySession(), request);
    } catch (ArtifactResolutionException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    return result.getArtifact().getFile();
}
 
開發者ID:wildfly,項目名稱:wildfly-maven-plugin,代碼行數:19,代碼來源:EclipseAetherArtifactResolver.java

示例9: retrieveArtifact

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
/**
 * Uses Aether to retrieve an artifact from the repository.
 *
 * @param coordinates as in groupId:artifactId:version
 * @return the located artifact
 */
Artifact retrieveArtifact(final String coordinates)
{

  final ArtifactRequest request = new ArtifactRequest();
  request.setArtifact(new DefaultArtifact(coordinates));
  request.setRepositories(remoteRepos);

  ArtifactResult result = null;
  try {
    result = repoSystem.resolveArtifact(repoSession, request);
  } catch (final ArtifactResolutionException e) {
    getLog().error("Could not resolve parent artifact (" + coordinates + "): " + e.getMessage());
  }

  if (result != null) {
    return RepositoryUtils.toArtifact(result.getArtifact());
  }
  return null;
}
 
開發者ID:mrice,項目名稱:license-check,代碼行數:26,代碼來源:OpenSourceLicenseCheckMojo.java

示例10: downloadAndInstallArtifact

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
protected ArtifactResult downloadAndInstallArtifact(String artifact) throws MojoExecutionException {
    ArtifactResult result;

    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact( new DefaultArtifact( artifact ) );
    request.setRepositories( remoteRepos );

    getLog().info( "Resolving artifact " + artifact + " from " + remoteRepos );
    try {
        result = repoSystem.resolveArtifact( repoSession, request );
        return result;
    } catch ( ArtifactResolutionException e ) {
        throw new MojoExecutionException( e.getMessage(), e );
    }
}
 
開發者ID:syndesisio,項目名稱:syndesis,代碼行數:16,代碼來源:RepackageExtensionMojo.java

示例11: resolveArtifact

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
private Artifact resolveArtifact(Artifact artifact) throws Exception {
    ArtifactRequest request = new ArtifactRequest();
    request.setArtifact(artifact);
    request.setRepositories(repositories());
    ArtifactResult result = system.resolveArtifact(session, request);
    return result.getArtifact();
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:8,代碼來源:AetherResolver.java

示例12: getArtifactRequests

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
private List<ArtifactRequest> getArtifactRequests(List<Dependency> dependencies) {
	List<ArtifactRequest> list = new ArrayList<>();
	for (Dependency dependency : dependencies) {
		ArtifactRequest request = new ArtifactRequest(dependency.getArtifact(), null,
				null);
		request.setRepositories(aetherRepositories(new Properties()));
		list.add(request);
	}
	return list;
}
 
開發者ID:spring-cloud,項目名稱:spring-cloud-function,代碼行數:11,代碼來源:DependencyResolver.java

示例13: makeRequest

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
private static ArtifactRequest makeRequest ( final List<RemoteRepository> repositories, final Artifact artifact )
{
    final ArtifactRequest artifactRequest = new ArtifactRequest ();
    artifactRequest.setArtifact ( artifact );
    artifactRequest.setRepositories ( repositories );
    return artifactRequest;
}
 
開發者ID:eclipse,項目名稱:packagedrone,代碼行數:8,代碼來源:AetherImporter.java

示例14: resolveArtifact

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
protected File resolveArtifact(Artifact artifact) throws MojoExecutionException, DependencyCollectionException {
   ArtifactRequest request = new ArtifactRequest();
   request.setArtifact(artifact);
   request.setRepositories(remoteRepos);

   ArtifactResult result;
   try {
      result = repositorySystem.resolveArtifact(repoSession, request);
   } catch (ArtifactResolutionException e) {
      throw new MojoExecutionException(e.getMessage(), e);
   }

   return result.getArtifact().getFile();
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:15,代碼來源:ArtemisAbstractPlugin.java

示例15: resolveArtifact

import org.eclipse.aether.resolution.ArtifactRequest; //導入方法依賴的package包/類
public ArtifactResult resolveArtifact(String groupId, String artifactId, String extension, String version) throws Exception {
  Artifact artifact = new DefaultArtifact(groupId, artifactId, extension, version);
  ArtifactRequest request = new ArtifactRequest();
  request.setArtifact(artifact);
  request.setRepositories(Collections.emptyList());
  return system.resolveArtifact(session, request);
}
 
開發者ID:vert-x3,項目名稱:vertx-maven-service-factory,代碼行數:8,代碼來源:AetherHelper.java


注:本文中的org.eclipse.aether.resolution.ArtifactRequest.setRepositories方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。