本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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()]));
}
示例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);
}
示例6: getCommandLine
import org.eclipse.che.api.core.util.CommandLine; //导入依赖的package包/类
@Override
public CommandLine getCommandLine() {
return new CommandLine("");
}
示例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;
}
示例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
}