List of usage examples for org.apache.maven.artifact.resolver ArtifactNotFoundException getRemoteRepositories
public List<ArtifactRepository> getRemoteRepositories()
From source file:org.jfrog.jade.plugins.idea.AbstractIdeaMojo.java
License:Apache License
protected void doDependencyResolution() throws InvalidDependencyVersionException, ProjectBuildingException, InvalidVersionSpecificationException { // If the execution root project is not a parent (meaning it is last one in reactor list) // Then the mojo will inherit manually its configuration if (reactorProjects != null) { int nbProjects = reactorProjects.size(); // Get the last project it contains the specific ideaj configuration if (nbProjects > 1) { MavenProject lastproject = reactorProjects.get(nbProjects - 1); if (lastproject.isExecutionRoot()) { //noinspection unchecked List<Plugin> plugins = lastproject.getBuildPlugins(); fillPluginSettings(plugins, "jade-idea-plugin", this, null); }//from w w w . j a v a 2s . c o m } } MavenProject project = getExecutedProject(); ArtifactRepository localRepo = getLocalRepository(); Map managedVersions = createManagedVersionMap(); try { ArtifactResolutionResult result = getArtifactResolver().resolveTransitively(getProjectArtifacts(), project.getArtifact(), managedVersions, localRepo, project.getRemoteArtifactRepositories(), artifactMetadataSource); project.setArtifacts(result.getArtifacts()); } catch (ArtifactNotFoundException e) { getLog().debug(e.getMessage(), e); StringBuffer msg = new StringBuffer(); msg.append("An error occurred during dependency resolution.\n\n"); msg.append(" Failed to retrieve ").append(e.getDownloadUrl()).append("\n"); msg.append("from the following repositories:"); for (Iterator repositories = e.getRemoteRepositories().iterator(); repositories.hasNext();) { ArtifactRepository repository = (ArtifactRepository) repositories.next(); msg.append("\n ").append(repository.getId()).append("(").append(repository.getUrl()).append(")"); } msg.append("\nCaused by: ").append(e.getMessage()); getLog().warn(msg); } catch (ArtifactResolutionException e) { getLog().debug(e.getMessage(), e); StringBuffer msg = new StringBuffer(); msg.append("An error occurred during dependency resolution of the following artifact:\n\n"); msg.append(" ").append(e.getGroupId()).append(":").append(e.getArtifactId()).append(e.getVersion()) .append("\n\n"); msg.append("Caused by: ").append(e.getMessage()); getLog().warn(msg); } }