Я хотел бы добавить файл в файл bootstrap.groovy в версии Grails 3.3.9.В bootstrap.groovy:
package com.nuevaconsulting
import com.nuevaconsulting.embrow.*
class BootStrap {
def init = { servletContext ->
def filePath = "C:/Grails/embrow/grails-app/conf/resourcesresources/1.csv"
new File(filePath).splitEachLine(',')
{
fields ->
def employee = new Employee(
mirId: fields[0].trim(),
cancer : fields[1].trim(),
profile : fields[1].trim(),
pubmed : fields[1].trim()
)
if ( employee.hasErrors() || employee.save(flush: true) == null) {
log.error("Could not import employee ${ employee.errors}")
}
log.debug("Importing employee ${ employee.toString()}")
}
def destroy = {}}}
Когда я запускаю run-app, я получаю следующую ошибку
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'.
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_201\bin\java.exe'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:369)
Error Failed to start server (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.util.concurrent.ExecutionException: org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.
Caused by: org.gradle.tooling.BuildException: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.5-bin.zip'.
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:51)
Caused by: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':bootRun'.
at org.gradle.initialization.DefaultExceptionAnalyser.transform(DefaultExceptionAnalyser.java:74)
at org.gradle.initialization.MultipleBuildFailuresExceptionAnalyser.transform(MultipleBuildFailuresExceptionAnalyser.java:47)
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'.
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
... 44 more
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_201\bin\java.exe'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:369)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:90)
... 78 more
| Error Failed to start server
Как добавить и визуализировать?