我試圖以運行多個任務:搖籃問題
task deleteTargetAndCopyfiles(type: Copy) {}
--> then:
task RunMavenCommands(type: Exec) {}
--> then:
task zipTheResults(type: Zip) {}
其中運行Exec任務,我有一個問題。 如果我使用:
task RunMavenCommands(type: Exec) {}
println '*******************************'
standardOutput = new ByteArrayOutputStream()
ext {
def startingDir = 'target/gradle_assembly'
def mavenOpt = '-Dmaven.test.skip=true -DskipTests=true'
def mavenRepo = '-Dmaven.repo.local=../../Tools/local/repository'
environment "MAVEN_OPTS", "${mavenOpt} ${mavenRepo}"
workingDir 'target/gradle_assembly'
def command = commandLine 'mvn', 'verify'
}
// doLast {
// println '*******************************'
// }
}
OR我運行:
task RunMavenCommands(type: Exec) {}
println '*******************************'
standardOutput = new ByteArrayOutputStream()
ext {
def startingDir = 'target/gradle_assembly'
def mavenOpt = '-Dmaven.test.skip=true -DskipTests=true'
def mavenRepo = '-Dmaven.repo.local=../../Tools/local/repository'
environment "MAVEN_OPTS", "${mavenOpt} ${mavenRepo}"
workingDir 'target/gradle_assembly'
def command = commandLine 'mvn', 'verify'
}
doLast {
println '*******************************'
}
}
我得到這個錯誤:
18:14:02.420 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING 18:14:02.421 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command 'mvn'.
18:14:02.476 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED 18:14:02.477 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command 'mvn'' finished with exit value -1 (state: FAILED)
18:14:02.477 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':mavenExecute' 18:14:02.478 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :mavenExecute FAILED 18:14:02.478 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :mavenExecute (Thread[main,5,main]) completed. Took 0.067 secs. 18:14:02.478 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 0.067 secs, idle: 0.001 secs 18:14:02.483 [ERROR] [org.gradle.BuildExceptionReporter] 18:14:02.483 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 18:14:02.483 [ERROR] [org.gradle.BuildExceptionReporter] 18:14:02.483 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 18:14:02.484 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':mavenExecute'. 18:14:02.484 [ERROR] [org.gradle.BuildExceptionReporter] > A problem occurred starting process 'command 'mvn''
我一直在試圖破解任何可能的方式在過去的3天沒有成功,也沒有看到有任何人有適合我的工作解決方案。
我也有相關性,而deleteTargetAndCopyfiles任務始終運行,但RunMave nCommands maven任務總是失敗。 –
上面的輸出是否使用'--stacktrace'運行?如果沒有,你可以添加輸出嗎? – romeara
上面是運行--debug –