当前位置: 首页>>代码示例>>Java>>正文


Java CommandLine类代码示例

本文整理汇总了Java中org.eclipse.che.api.core.util.CommandLine的典型用法代码示例。如果您正苦于以下问题:Java CommandLine类的具体用法?Java CommandLine怎么用?Java CommandLine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CommandLine类属于org.eclipse.che.api.core.util包,在下文中一共展示了CommandLine类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clear

import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
/**
 * Execute workspace cleanUp script.
 *
 * @param workspace to cleanUp files.
 * @throws IOException in case I/O error.
 * @throws ServerException in case internal server error.
 */
@Override
public void clear(Workspace workspace) throws IOException, ServerException {
  File wsFolder =
      workspaceIdHashLocationFinder.calculateDirPath(backupsRootDir, workspace.getId());
  CommandLine commandLine = new CommandLine(workspaceCleanUpScript, wsFolder.getAbsolutePath());

  try {
    execute(commandLine.asArray(), cleanUpTimeOut);
  } catch (InterruptedException | TimeoutException e) {
    throw new ServerException(
        format(
            "Failed to delete workspace files by path: '%s' for workspace with id: '%s'",
            wsFolder.getAbsolutePath(), workspace.getId()),
        e);
  }
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:24,代码来源:WorkspaceFilesCleanUpScriptExecutor.java

示例2: executeTests

import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
public ProcessHandler executeTests(TestExecutionContext context) {
  String projectPath = context.getProjectPath();
  String testTargetRelativePath = context.getFilePath();
  String projectAbsolutePath = ResourcesPlugin.getPathToWorkspace() + projectPath;
  File testTargetFile = getTestTargetFile(testTargetRelativePath, projectAbsolutePath);
  File testTargetWorkingDirectory =
      testTargetFile.isDirectory() ? testTargetFile : testTargetFile.getParentFile();
  // Get appropriate path to executable
  String phpUnitExecutable = PHPUNIT_GLOBAL;
  if (hasComposerRunner(projectPath)) {
    phpUnitExecutable = projectAbsolutePath + PHPUNIT_COMPOSER;
  }
  // Get appropriate logger for PHP unit version
  final File printerFile = getPrinterFile();
  final String printerDirAbsolutePath = printerFile.getParentFile().getAbsolutePath();
  final CommandLine cmdRunTests =
      new CommandLine(
          phpUnitExecutable,
          "--include-path",
          printerDirAbsolutePath,
          "--printer",
          PRINTER_NAME,
          getTestTarget(testTargetFile));
  ProcessBuilder pb =
      new ProcessBuilder()
          .redirectErrorStream(true)
          .directory(testTargetWorkingDirectory)
          .command(cmdRunTests.toShellCommand());
  pb.environment().put("ZEND_PHPUNIT_PORT", String.valueOf(PRINTER_PORT));
  try {
    return new ProcessHandler(pb.start());
  } catch (IOException e) {
    LOG.error("Can't run PHPUnit", e);
  }

  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:38,代码来源:PHPUnitTestEngine.java

示例3: readMavenVersionInformation

import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
private static void readMavenVersionInformation(LineConsumer cmdOutput) throws IOException {
  final CommandLine commandLine = new CommandLine(getMavenExecCommand()).add("-version");
  final ProcessBuilder processBuilder =
      new ProcessBuilder().command(commandLine.toShellCommand()).redirectErrorStream(true);
  final Process process = processBuilder.start();
  ProcessUtil.process(process, cmdOutput, LineConsumer.DEV_NULL);
}
 
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:MavenUtils.java

示例4: buildCommandLine

import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
public CommandLine buildCommandLine() {
    List<String> params = new ArrayList<>();
    params.add(getCommand());
    params.addAll(Arrays.asList(getParameters()));
    return new CommandLine(params.toArray(new String[params.size()]));
}
 
开发者ID:AdaptiveMe,项目名称:adaptive-services-dashbar,代码行数:7,代码来源:CommandLineBuilder.java

示例5: createTaskFor

import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
@Override
protected Callable<Boolean> createTaskFor(CommandLine commandLine, BuildLogger logger, long timeout, final BuilderConfiguration configuration) {
    return new AdaptiveBuilderTask(configuration);
}
 
开发者ID:AdaptiveMe,项目名称:adaptive-services-dashbar,代码行数:5,代码来源:AdaptiveBuilder.java

示例6: getCommandLine

import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
@Override
public CommandLine getCommandLine() {
    return new CommandLine("");
}
 
开发者ID:AdaptiveMe,项目名称:adaptive-services-dashbar,代码行数:5,代码来源:AdaptiveBuilder.java

示例7: createCommandLine

import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
/**
 * Create specified command for maven archetype plugin e.g mvn archetype:generate
 * -DgroupId=com.mycompany.app -DartifactId=my-app
 * -DarchetypeArtifactId=maven-archetype-quickstart
 *
 * @param archetypeProperties
 * @return command line ready to execute
 */
private CommandLine createCommandLine(Map<String, String> archetypeProperties) {
  final CommandLine commandLine = new CommandLine(MavenUtils.getMavenExecCommand());
  commandLine.add("--batch-mode");
  commandLine.add("org.apache.maven.plugins:maven-archetype-plugin:RELEASE:generate");
  commandLine.add(archetypeProperties);
  return commandLine;
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:ArchetypeGenerator.java

示例8: createCommandLine

import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
/**
 * We are not using the command line, this is for builds that need a command line.
 *
 * @param config the build config
 * @return should return a command line to prevent NullPointerExceptions but it won't do anything
 * @throws BuilderException
 */
@Override
protected CommandLine createCommandLine(BuilderConfiguration config) throws BuilderException {
    return new CommandLine("date"); //adding a date to the logs :P
}
 
开发者ID:AdaptiveMe,项目名称:adaptive-services-dashbar,代码行数:12,代码来源:AdaptiveBuilder.java


注:本文中的org.eclipse.che.api.core.util.CommandLine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。