use of aQute.struct.struct.Error in project bnd by bndtools.
the class Main method _install.
/**
* A better way to install
*/
@Description("Install an artifact from a url, file, or http://www.jpm4j.org")
public void _install(installOptions opts) throws Exception {
if (!this.options.user() && !jpm.hasAccess()) {
error("No write acces, might require administrator or root privileges (sudo in *nix)");
return;
}
for (String coordinate : opts._arguments()) {
logger.debug("install {}", coordinate);
File file = IO.getFile(base, coordinate);
if (file.isFile()) {
coordinate = file.toURI().toString();
logger.debug("is existing file: {}", coordinate);
}
ArtifactData artifact = jpm.getCandidate(coordinate);
logger.debug("candidate {}", artifact);
if (artifact == null) {
if (jpm.isWildcard(coordinate))
error("no candidate found for %s", coordinate);
else
error("no candidate found for %s, you could try %s@* to also see staged and withdrawn revisions", coordinate, coordinate);
} else {
if (!opts.ignore()) {
CommandData cmd = jpm.parseCommandData(artifact);
updateCommandData(cmd, opts);
logger.debug("main={}, name={}", cmd.main, cmd.name);
if (cmd.main != null) {
if (cmd.name == null && !artifact.local) {
cmd.name = artifact.coordinate.getArtifactId();
}
List<Error> errors = cmd.validate();
if (!errors.isEmpty()) {
error("Command not valid");
for (Error error : errors) {
error("[%s] %s %s %s %s", error.code, error.description, error.path, error.failure, error.value);
}
} else {
String result = jpm.createCommand(cmd, opts.force());
if (result != null) {
error("[%s] %s", coordinate, result);
}
}
} else
error("No main class found. Please specify");
}
}
}
}
Aggregations