私はgradleでデプロイメントスクリプトを作成しています。私はそれをs3にアップロードし、コードデプロイメント経由でリビジョンをデプロイするために自分のアプリケーションを解凍する必要があります。私はこれを達成するために手動でzip -r Archive.zip *
を実行することができます。しかし、私がgradleで同じコマンドを実行しようとすると、エラーが発生します。下記のデバッグログを参照してください。Cant zip application via gradle
タスク:
task zip {
doLast {
exec {
workingDir '.'
commandLine 'zip', '-r', 'Archive.zip', '*'
}
}
}
ログイン:
13:01:24.961 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTING
13:01:24.961 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Waiting until process started: command 'zip'.
13:01:24.987 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: STARTED
13:01:24.988 [DEBUG] [org.gradle.process.internal.ExecHandleRunner] waiting until streams are handled...
13:01:24.988 [INFO] [org.gradle.process.internal.DefaultExecHandle] Successfully started process 'command 'zip''
13:01:25.018 [QUIET] [system.out]
13:01:25.018 [QUIET] [system.out] zip error: Nothing to do! (try: zip -r Archive.zip . -i *)
13:01:25.019 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Changing state to: FAILED
13:01:25.019 [DEBUG] [org.gradle.process.internal.DefaultExecHandle] Process 'command 'zip'' finished with exit value 12 (state: FAILED)
13:01:25.019 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Execute doLast {} action for :zip'
13:01:25.019 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
13:01:25.020 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':zip'
13:01:25.020 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Task :zip'
13:01:25.020 [null] [org.gradle.internal.progress.DefaultBuildOperationExecutor]
13:01:25.020 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Build operation 'Task :zip' completed
13:01:25.020 [INFO] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] :zip (Thread[Task worker for ':',5,main]) completed. Took 0.063 secs.
13:01:25.020 [DEBUG] [org.gradle.internal.work.DefaultWorkerLeaseService] Worker lease root.1.2 completed (1 worker(s) in use)
13:01:25.020 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':': released lock on root.1.2
13:01:25.020 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Task worker for ':': released lock on :
13:01:25.020 [DEBUG] [org.gradle.execution.taskgraph.DefaultTaskPlanExecutor] Task worker [Thread[Task worker for ':',5,main]] finished, busy: 0.063 secs, idle: 0.002 secs
12:56:42.933 [DEBUG] [org.gradle.internal.progress.DefaultBuildOperationExecutor] Completing Build operation 'Run tasks'
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file '/app/build.gradle' line: 50
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':zip'.
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Process 'command 'zip'' finished with non-zero exit value 12
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
12:56:42.935 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 0s
私は事前に定義されたタスクをしようとしたが、何かを圧縮していないようだと、私はそれをキャンセルするまでだけでハングアップします。また、zip -r Archive.zip *をgradleの外側で実行すると、成功します。 – Freid001
@ Freid001コマンドを実行してもう一度試してください。 – Opal
downvotingの理由は何ですか? – Opal