gradle-docker-plugin: `apply from:` always failed

I creat th common.jar with file common.gradle

apply plugin: "com.bmuschko.docker-remote-api"

import com.bmuschko.gradle.docker.tasks.image.*

task createDockerfile(type: Dockerfile) {
  dependsOn build
  destFile = project.file("build/docker/Dockerfile")
  from "java:8"
  volume "/tmp"
  addFile jar.getArchiveName(), "app.jar"
  runCommand "bash -c 'touch /app.jar'"
  entryPoint "java", "-Djava.security.egd=file:/dev/./urandom", "-Xms1024M", "-Xmx1024M", "-jar", "/app.jar"
  doFirst {
    copy {
      from jar
      into "build/docker/"
    }
  }
}

and use in other project’s build.gradle

buildscript {
    ext {
      commonVersion = "1.0-SNAPSHOT"
      gradleDockerPluginVersion = "3.0.0"
    }

    repositories {
      mavenLocal()
    }

    dependencies {
      classpath("common:common:${commonVersion}")
      classpath("com.bmuschko:gradle-docker-plugin:${gradleDockerPluginVersion}")
    }
  }

apply from: project.buildscript.classLoader.getResource("common.gradle")

alway faild :

17:54:57.164 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
17:54:57.165 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating script.
17:54:57.165 [ERROR] [org.gradle.BuildExceptionReporter] > Could not find property 'Dockerfile' on project ':demo'.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

isn’t this one another case of having to apply plugin: com.bmuschko.gradle.docker.DockerRemoteApiPlugin instead of apply plugin: "com.bmuschko.docker-remote-api" when applying a plugin in a non-build.gradle file?