本文整理匯總了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);
}
}
}
示例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;
}
示例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);
}
示例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();
}
}
示例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());
}
示例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);
}
}
示例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 );
}
}
示例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 () );
}
示例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 );
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}