Open justin2108 opened 6 years ago
It's not clear from this output what caused the task to fail. Can you try running again with the --stacktrace
option?
Hi,
I'm having the same issue as justin2108. After running gradlew docker build
I recieve an error:
> Task :docker FAILED
Task ':docker' is not up-to-date because:
Task has not declared any outputs.
I'm following instructions here to learn from. Also I noticed the instructions were a bit off or something changed in the newer version of this project. But I had to add a repository manually because it was not downloading the necessary dependencies for the plugin.
This is what my gradle build file looks like:
buildscript {
ext {
springBootVersion = '2.0.2.RELEASE'
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
dependencies {
classpath('gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.19.2')
}
}
group = 'saurinp12'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.palantir.docker'
docker {
dependsOn build
name "${project.group}/${bootJar.baseName}"
files bootJar.archivePath
buildArgs(['JAR_FILE': "${bootJar.archiveName}"])
}
group = 'com.demo'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Here's the stacktrace for it:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':docker'.
> A problem occurred starting process 'command 'docker''
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':docker'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:623)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:578)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'docker''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:226)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:204)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:349)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:85)
at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39)
... 3 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'docker'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:67)
... 4 more
Caused by: java.io.IOException: Cannot run program "docker" (in directory "C:\Users\sauri\Documents\IdeaProjects\helloworld-rest\build\docker"): CreateProcess error=267, The directory name is invalid
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 7 more
Caused by: java.io.IOException: CreateProcess error=267, The directory name is invalid
... 8 more
Thanks in advance!
Solved the above issue. My gradle build file was missing bootJar information and I apparently skipped the part where you were supposed to have a seed for Dockerfile. For complete and current code for the guide provided by spring boot I recommend you go to this link in git hub.
Just` tried to build on osx and it failed. using Gradle 3.5.1
am i missing something ? after a fail is gradle and i run the docker build command my self everything is fine ?
buidl.gradle docker { dockerfile file('Dockerfile') name "${project.group}/${jar.baseName}" tags 'latest' files jar.archivePath, tasks.distTar.outputs buildArgs([BUILD_VERSION: 'version']) buildArgs(['JAR_FILE': "${jar.archiveName}"]) pull true noCache true }
Output: :build (Thread[Daemon worker Thread 17,5,main]) completed. Took 0.0 secs. :dockerClean (Thread[Daemon worker Thread 17,5,main]) started. :dockerClean Putting task artifact state for task ':dockerClean' into context took 0.0 secs. Executing task ':dockerClean' (up-to-date check took 0.0 secs) due to: Task has not declared any outputs. :dockerClean (Thread[Daemon worker Thread 17,5,main]) completed. Took 0.002 secs. :dockerPrepare (Thread[Daemon worker Thread 17,5,main]) started. :dockerPrepare Putting task artifact state for task ':dockerPrepare' into context took 0.0 secs. Task :dockerPrepare class loader hash: 0c0afac576bb2de41200bc36bccb9200 Task :dockerPrepare actions class loader hashes: [0c0afac576bb2de41200bc36bccb9200] Executing task ':dockerPrepare' (up-to-date check took 0.232 secs) due to: Output property 'destinationDir' file /build/docker has changed. Output property 'destinationDir' file /build/docker/Dockerfile has been removed. Output property 'destinationDir' file /build/docker/loyalty-api-1.3.5.jar has been removed. :dockerPrepare (Thread[Daemon worker Thread 17,5,main]) completed. Took 1.204 secs. :docker (Thread[Daemon worker Thread 17,5,main]) started. :docker Putting task artifact state for task ':docker' into context took 0.0 secs. Executing task ':docker' (up-to-date check took 0.0 secs) due to: Task has not declared any outputs. Starting process 'command 'docker''. Working directory: //build/docker Command: docker build --no-cache --build-arg JAR_FILE=loyalty-api-1.3.5.jar --pull -t huntercrm/loyalty-api . :docker FAILED :docker (Thread[Daemon worker Thread 17,5,main]) completed. Took 0.016 secs.`