use of org.gradle.api.tasks.TaskExecutionException in project spring-boot by spring-projects.
the class MavenExec method exec.
@Override
public void exec() {
workingDir(this.projectDir);
systemProperty("maven.multiModuleProjectDirectory", this.projectDir.getAbsolutePath());
try {
Path logFile = Files.createTempFile(getName(), ".log");
try {
args("--log-file", logFile.toFile().getAbsolutePath());
super.exec();
if (this.log.isInfoEnabled()) {
Files.readAllLines(logFile).forEach(this.log::info);
}
} catch (ExecException ex) {
System.out.println("Exec exception! Dumping log");
Files.readAllLines(logFile).forEach(System.out::println);
throw ex;
}
} catch (IOException ex) {
throw new TaskExecutionException(this, ex);
}
}
use of org.gradle.api.tasks.TaskExecutionException in project gradle by gradle.
the class ExecuteActionsTaskExecuter method executeIfValid.
private TaskExecuterResult executeIfValid(TaskInternal task, TaskStateInternal state, TaskExecutionContext context, TaskExecution work) {
ExecutionEngine.Request request = executionEngine.createRequest(work);
context.getTaskExecutionMode().getRebuildReason().ifPresent(request::forceNonIncremental);
request.withValidationContext(context.getValidationContext());
Result result = request.execute();
result.getExecutionResult().ifSuccessfulOrElse(executionResult -> state.setOutcome(TaskExecutionOutcome.valueOf(executionResult.getOutcome())), failure -> state.setOutcome(new TaskExecutionException(task, failure)));
return new TaskExecuterResult() {
@Override
public Optional<OriginMetadata> getReusedOutputOriginMetadata() {
return result.getReusedOutputOriginMetadata();
}
@Override
public boolean executedIncrementally() {
return result.getExecutionResult().map(executionResult -> executionResult.getOutcome() == ExecutionOutcome.EXECUTED_INCREMENTALLY).getOrMapFailure(throwable -> false);
}
@Override
public List<String> getExecutionReasons() {
return result.getExecutionReasons();
}
@Override
public CachingState getCachingState() {
return result.getCachingState();
}
};
}
use of org.gradle.api.tasks.TaskExecutionException in project azure-gradle-plugins by lenala.
the class AddTask method add.
@TaskAction
void add() {
try {
final List<FunctionTemplate> templates = loadAllFunctionTemplates();
final FunctionTemplate template = getFunctionTemplate(templates);
final Map params = prepareRequiredParameters(template);
final String newFunctionClass = substituteParametersInTemplate(template, params);
saveNewFunctionToFile(newFunctionClass);
} catch (Exception ex) {
throw new TaskExecutionException(this, ex);
}
}
use of org.gradle.api.tasks.TaskExecutionException in project azure-gradle-plugins by lenala.
the class DeployTask method deployFunction.
@TaskAction
void deployFunction() {
try {
getLogger().quiet(FUNCTION_DEPLOY_START + getAppName() + "...");
createOrUpdateFunctionApp();
getArtifactHandler().publish();
getLogger().quiet(String.format(FUNCTION_DEPLOY_SUCCESS, getAppName()));
} catch (Exception ex) {
throw new TaskExecutionException(this, ex);
}
}
use of org.gradle.api.tasks.TaskExecutionException in project azure-gradle-plugins by lenala.
the class RunTask method runFunction.
@TaskAction
void runFunction() {
try {
checkStageDirectoryExistence();
checkRuntimeExistence();
runFunctions();
} catch (Exception ex) {
throw new TaskExecutionException(this, ex);
}
}
Aggregations