private Dependency resolveDependency(Collection parents, Dependency dependency, Stack<Dependency> parentStack) throws MissingDependencyException { Artifact artifact = dependency.getArtifact(); // if it is already resolved we are done if (artifact.isResolved()) { return dependency; } // we need an artifact resolver at this point if (artifactResolver == null) { throw new MissingDependencyException("Artifact is not resolved and there no artifact resolver available: " + artifact); } // resolve the artifact try { artifact = artifactResolver.resolveInClassLoader(artifact, parents); } catch (MissingDependencyException e) { // I'm throwing away the original error as the new message is lost on the stack as // most folks will drill down to the message on the bottom of the stack. StringBuffer sb = new StringBuffer(); sb.append(e.getMessage().trim()+"\n"+" Parent stack:\n"); boolean first = true; for (Dependency d : parentStack) { sb.append(" "+d.getArtifact().toString().trim()+(first?" (top)":"")+"\n"); first = false; } throw new MissingDependencyException(sb.toString()); } // build a new dependency object to contain the resolved artifact Dependency resolvedDependency = new Dependency(artifact, dependency.getImportType()); return resolvedDependency; }
public File resolve(Artifact artifact) throws MissingDependencyException { for (Iterator j = repositories.iterator(); j.hasNext();) { Repository repository = (Repository) j.next(); if (repository.contains(artifact)) { File file = repository.getLocation(artifact); return file; } } throw new MissingDependencyException("Unable to resolve dependency " + artifact); }
public static void printResults(ConsoleReader consoleReader, DownloadResults results, int time) throws IOException, DeploymentException { consoleReader.printNewline(); if (!results.isFailed()) { DeployUtils.println("**** Installation Complete!", 0, consoleReader); for (MissingDependencyException e : results.getSkippedPlugins()) { DeployUtils.println(e.getMessage(), 0, consoleReader); } for (Artifact uri: results.getDependenciesPresent()) { DeployUtils.println("Used existing: " + uri, 0, consoleReader); } for (Artifact uri: results.getDependenciesInstalled()) { DeployUtils.println("Installed new: " + uri, 0, consoleReader); } consoleReader.printNewline(); if (results.getTotalDownloadBytes() > 0 && time > 0) { DeployUtils.println( "Downloaded " + (results.getTotalDownloadBytes() / 1024) + " kB in " + time + "s (" + results.getTotalDownloadBytes() / (1024 * time) + " kB/s)", 0, consoleReader); } } } }
private void verifyPrerequisites(PluginType plugin) throws MissingDependencyException { List<Dependency> missingPrereqs = getMissingPrerequisites(plugin); if (!missingPrereqs.isEmpty()) { PluginArtifactType metadata = plugin.getPluginArtifact().get(0); Artifact moduleId = toArtifact(metadata.getModuleId()); StringBuilder buf = new StringBuilder(); buf.append(moduleId.toString()).append(" requires "); Iterator<Dependency> iter = missingPrereqs.iterator(); while (iter.hasNext()) { buf.append(iter.next().getArtifact().toString()); if (iter.hasNext()) { buf.append(", "); } } buf.append(" to be installed"); throw new MissingDependencyException(buf.toString(), null, (Artifact) null); } }
public Artifact resolveInClassLoader(Artifact source, Collection parentConfigurations) throws MissingDependencyException { // Some tests break if we acntually try to search for fully-resolved artifacts if(source.isResolved()) { return source; } // if (artifact.getType() == null) { // throw new IllegalArgumentException("Type not set " + artifact); // } // // String groupId = source.getGroupId(); // if (groupId == null) { // groupId = Artifact.DEFAULT_GROUP_ID; // } // Version version = source.getVersion(); Artifact working = resolveVersion(parentConfigurations, source); if (working == null || !working.isResolved()) { throw new MissingDependencyException("Unable to resolve dependency " + source); } return working; }
throw new MissingDependencyException("A plugin configuration must include one plugin artifact, not " + plugin.getPluginArtifact().size(), null, (Stack<Artifact>) null); throw new MissingDependencyException( "Plugin is not installable on Geronimo " + serverInfo.getVersion(), toArtifact(metadata.getModuleId()), (Stack<Artifact>) null); throw new MissingDependencyException( "Plugin is not installable on JVM " + System.getProperty("java.version"), toArtifact(metadata.getModuleId()), (Stack<Artifact>) null);
monitor.getResults().addSkippedConfigID(new MissingDependencyException("already installed", configID, (Stack<Artifact>) null)); return;
if (validatePlugins) { if (!validatePlugin(metadata)) { throw new MissingDependencyException("Already installed", toArtifact(metadata.getPluginArtifact().get(0).getModuleId()), (Stack<Artifact>) null);