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


Java ArtifactResolutionException類代碼示例

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


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

示例1: fillfromExtraDependencies

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
protected void fillfromExtraDependencies(final Manifest manifest, final Map<String, File> files)
        throws IOException, MojoExecutionException {
    if (this.additionalDependencies != null) {
        try {
            final Collection<ArtifactRequest> requests = new ArrayList<>(this.additionalDependencies.length);

            for (final Dependency dep : this.additionalDependencies) {
                final DefaultArtifact art = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(),
                        dep.getClassifier(), dep.getType(), dep.getVersion());
                final org.eclipse.aether.graph.Dependency adep = new org.eclipse.aether.graph.Dependency(art,
                        JavaScopes.RUNTIME);
                requests.add(new ArtifactRequest(new DefaultDependencyNode(adep)));
            }

            final List<ArtifactResult> result = this.resolver.resolveArtifacts(this.repositorySession, requests);

            for (final ArtifactResult ares : result) {
                getLog().debug("Additional dependency: " + ares);
                processArtifact(manifest, files, ares.getArtifact().getFile());
            }
        } catch (final ArtifactResolutionException e) {
            throw new MojoExecutionException("Failed to resolve additional dependencies", e);
        }
    }
}
 
開發者ID:ctron,項目名稱:osgi-dp,代碼行數:26,代碼來源:AbstractDpMojo.java

示例2: createCasesWithDependencies

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
private List<PinpointPluginTestInstance> createCasesWithDependencies(PinpointPluginTestContext context) throws ArtifactResolutionException, DependencyResolutionException {
    List<PinpointPluginTestInstance> cases = new ArrayList<PinpointPluginTestInstance>();

    DependencyResolver resolver = DependencyResolver.get(repositories);
    Map<String, List<Artifact>> dependencyCases = resolver.resolveDependencySets(dependencies);

    for (Map.Entry<String, List<Artifact>> dependencyCase : dependencyCases.entrySet()) {
        List<String> libs = new ArrayList<String>();

        for (File lib : resolver.resolveArtifactsAndDependencies(dependencyCase.getValue())) {
            libs.add(lib.getAbsolutePath());
        }

        if (testOnSystemClassLoader) {
            cases.add(new NormalPluginTestCase(context, dependencyCase.getKey(), libs, true));
        }

        if (testOnChildClassLoader) {
            cases.add(new NormalPluginTestCase(context, dependencyCase.getKey(), libs, false));
        }
    }

    return cases;
}
 
開發者ID:naver,項目名稱:pinpoint,代碼行數:25,代碼來源:PinpointPluginTestSuite.java

示例3: load

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的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

示例4: resolvePluginDependency

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的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

示例5: resolve

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
private List<File> resolve(List<Dependency> dependencies)
		throws ArtifactResolutionException {
	try {
		CollectRequest collectRequest = getCollectRequest(dependencies);
		DependencyRequest dependencyRequest = getDependencyRequest(collectRequest);
		DependencyResult result = this.repositorySystem
				.resolveDependencies(this.session, dependencyRequest);
		addManagedDependencies(result);
		return getFiles(result);
	}
	catch (Exception ex) {
		throw new DependencyResolutionFailedException(ex);
	}
	finally {
		this.progressReporter.finished();
	}
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:18,代碼來源:AetherGrapeEngine.java

示例6: download

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
public List<ArtifactDescriptor> download(List<ArtifactInfo> unresolvedArtifacts) throws IOException {
  List<RemoteRepository> repositories = this.remoteRepositories;
  List<ArtifactRequest> artifactRequests = unresolvedArtifacts.stream()
      .map(dependency -> {
        ArtifactRequest artifactRequest = new ArtifactRequest();
        artifactRequest.setArtifact(dependency.artifact);
        artifactRequest.setRepositories(repositories);
        return artifactRequest;
      })
      .collect(Collectors.toList());

  List<ArtifactResult> artifactResults;
  try {
    artifactResults = system.resolveArtifacts(session, artifactRequests);
  } catch (ArtifactResolutionException e) {
    throw new IOException(e);
  }
  
  return artifactResults.stream()
    .map(result -> new ArtifactDescriptor(result.getArtifact()))
    .collect(Collectors.toList());
}
 
開發者ID:forax,項目名稱:pro,代碼行數:23,代碼來源:Aether.java

示例7: getArtifact

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
private File getArtifact(final String groupId, final String artifactId, final String classifier, final String extension, final String version) throws MojoExecutionException {
	final DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, classifier, extension, version);

	final LocalArtifactRequest localRequest = new LocalArtifactRequest(artifact, projectRepoList, null);
	final LocalRepositoryManager localManager = repoSession.getLocalRepositoryManager();
	final LocalArtifactResult localResult = localManager.find(repoSession, localRequest);
	if (localResult.isAvailable()) {
		return localResult.getFile();
	}

	try {
		final ArtifactRequest remoteRequest = new ArtifactRequest(artifact, projectRepoList, null);
		final ArtifactResult remoteResult = repoSystem.resolveArtifact(repoSession, remoteRequest);
		return remoteResult.getArtifact().getFile();
	}
	catch (final ArtifactResolutionException e) {
		throw new MojoExecutionException("Could not retrieve artifact", e);
	}
}
 
開發者ID:wmono,項目名稱:tsc-maven-plugin,代碼行數:20,代碼來源:AbstractTypeScriptMojo.java

示例8: resolve

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
private URL resolve( Artifact artifact )
    throws MojoExecutionException
{
    ArtifactRequest request = new ArtifactRequest( artifact, remoteRepository, null );

    try
    {
        return
            repositorySystem
                .resolveArtifact( repositorySession, request )
                .getArtifact()
                .getFile()
                .toURI()
                .toURL();
    }
    catch ( ArtifactResolutionException | MalformedURLException e )
    {
        throw new MojoExecutionException( "Cannot resolve artifact: " + artifact, e );
    }
}
 
開發者ID:expretio,項目名稱:capnp-maven-plugin,代碼行數:21,代碼來源:CapnProtoMojo.java

示例9: preparePlain

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
/**
 * Prepare a plain import process
 * <p>
 * Prepare a simple import request with a specific list of coordinates
 * </p>
 */
public static AetherResult preparePlain ( final Path tmpDir, final ImportConfiguration cfg ) throws ArtifactResolutionException
{
    Objects.requireNonNull ( tmpDir );
    Objects.requireNonNull ( cfg );

    final RepositoryContext ctx = new RepositoryContext ( tmpDir, cfg.getRepositoryUrl (), cfg.isAllOptional () );

    // extend

    final List<ArtifactRequest> requests = extendRequests ( cfg.getCoordinates ().stream ().map ( c -> {
        final DefaultArtifact artifact = new DefaultArtifact ( c.toString () );
        return makeRequest ( ctx.getRepositories (), artifact );
    } ), ctx, cfg );

    // process

    return asResult ( resolve ( ctx, requests ), cfg, empty () );
}
 
開發者ID:eclipse,項目名稱:packagedrone,代碼行數:25,代碼來源:AetherImporter.java

示例10: processImport

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
/**
 * Process the actual import request
 * <p>
 * This method takes the import configuration as is and simply tries to
 * import it. Not manipulating the list of coordinates any more
 * </p>
 */
public static Collection<ArtifactResult> processImport ( final Path tmpDir, final ImportConfiguration cfg ) throws ArtifactResolutionException
{
    Objects.requireNonNull ( tmpDir );
    Objects.requireNonNull ( cfg );

    final RepositoryContext ctx = new RepositoryContext ( tmpDir, cfg.getRepositoryUrl () );

    final Collection<ArtifactRequest> requests = new LinkedList<> ();

    for ( final MavenCoordinates coords : cfg.getCoordinates () )
    {
        // main artifact

        final DefaultArtifact main = new DefaultArtifact ( coords.toString () );
        requests.add ( makeRequest ( ctx.getRepositories (), main ) );
    }

    // process

    return ctx.getSystem ().resolveArtifacts ( ctx.getSession (), requests );
}
 
開發者ID:eclipse,項目名稱:packagedrone,代碼行數:29,代碼來源:AetherImporter.java

示例11: resolveArtifact

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
private File resolveArtifact(final String group,
                             final String name,
                             final String version,
                             final String classifier,
                             final String type) throws ArtifactResolutionException {
    final DefaultArtifact artifact = new DefaultArtifact(group, name, classifier, type, version);
    final LocalArtifactResult localResult = this.repositorySystemSession.getLocalRepositoryManager()
            .find(this.repositorySystemSession, new LocalArtifactRequest(artifact, this.remoteRepositories, null));
    File file = null;

    if (localResult.isAvailable()) {
        file = localResult.getFile();
    } else {
        final ArtifactResult result;
        result = resolver.resolveArtifact(this.repositorySystemSession,
                                          new ArtifactRequest(artifact, this.remoteRepositories, null));
        if (result.isResolved()) {
            file = result.getArtifact().getFile();
        }
    }

    return file;
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm-fraction-plugin,代碼行數:24,代碼來源:FractionReferenceMojo.java

示例12: containsArtifact

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
@Override
public boolean containsArtifact(final GAV gav) {
    ArtifactRequest request = createArtifactRequest(gav);
    try {
        Aether aether = Aether.getAether();
        aether.getSystem().resolveArtifact(aether.getSession(),
                                           request);
    } catch (ArtifactResolutionException e) {
        logger.trace("Artifact {} not found.",
                     gav,
                     e);
        return false;
    }
    logger.trace("Artifact {} found.",
                 gav);
    return true;
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:18,代碼來源:FileSystemArtifactRepository.java

示例13: getArtifactFileFromRepository

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
@Override
public File getArtifactFileFromRepository(final GAV gav) {
    ArtifactRequest request = createArtifactRequest(gav);
    ArtifactResult result = null;
    try {
        result = Aether.getAether().getSystem().resolveArtifact(
                Aether.getAether().getSession(),
                request);
    } catch (ArtifactResolutionException e) {
        logger.warn(e.getMessage(),
                    e);
    }

    if (result == null) {
        return null;
    }

    File artifactFile = null;
    if (result.isResolved() && !result.isMissing()) {
        artifactFile = result.getArtifact().getFile();
    }

    return artifactFile;
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:25,代碼來源:FileSystemArtifactRepository.java

示例14: fetchDependency

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的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

示例15: resolveDevServerJar

import org.eclipse.aether.resolution.ArtifactResolutionException; //導入依賴的package包/類
public String resolveDevServerJar() {
    String version = getYawpVersion();
    List<RemoteRepository> allRepos = ImmutableList.copyOf(Iterables.concat(getProjectRepos()));

    ArtifactRequest request = new ArtifactRequest(new DefaultArtifact(YAWP_GROUP_ID, YAWP_DEVSERVER_ARTIFACT_ID, "jar", version), allRepos,
            null);

    ArtifactResult result;
    try {
        result = repoSystem.resolveArtifact(repoSession, request);
    } catch (ArtifactResolutionException e) {
        throw new RuntimeException("Could not resolve DevServer artifact in Maven.");
    }

    return result.getArtifact().getFile().getPath();
}
 
開發者ID:feroult,項目名稱:yawp,代碼行數:17,代碼來源:DevServerMojo.java


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