Java 类io.vertx.core.cli.CLIException 实例源码

项目:vertx-stack    文件:ResolveCommand.java   
/**
 * Executes the command.
 * @throws CLIException if something bad happened during the execution.
 */
@Override
public void run() throws CLIException {
  File descriptorFile = new File(descriptor);
  if (! descriptorFile.isFile()) {
    // Try with vert.x home
    if (Home.getVertxHome() != null) {
      descriptorFile = new File(Home.getVertxHome(), descriptor);
    }
  }

  if (! descriptorFile.isFile()) {
    String message = "Cannot find the stack descriptor. Have been tried: \n\t - ./" + descriptorFile;
    if (Home.getVertxHome() != null) {
      message += "\n\t - " + descriptorFile.getAbsolutePath();
    }
    throw new CLIException(message);
  }

  File lib;
  if (directory == null) {
    if (Home.getVertxHome() != null) {
      lib = new File(Home.getVertxHome(), "lib");
    } else {
      lib = new File("lib");
    }
  } else {
    lib = new File(directory);
  }

  out().println("lib directory set to: " + lib.getAbsolutePath());

  Stack stack = Stack.fromDescriptor(descriptorFile);
  StackResolutionOptions options = new StackResolutionOptions()
      .setFailOnConflicts(failOnConflict)
      .setCacheDisabled(disableCache)
      .setCacheDisabledForSnapshots(disableCacheForSnapshots)
      .setCacheFile(cacheFile);

  if (localRepository != null) {
    options.setLocalRepository(localRepository);
  }

  if (remoteRepositories != null) {
    options.setRemoteRepositories(remoteRepositories);
  }

  options.setHttpProxy(httpProxy);
  options.setHttpsProxy(httpsProxy);

  StackResolution resolution = new StackResolution(stack, lib, options);
  resolution.resolve();
}
项目:apiman    文件:ApimanVersionCommand.java   
@Override
public void run() throws CLIException {
    log.info("Apiman " + getApimanVersion());
    log.info("Vert.x " + VersionCommand.getVersion());
}