gradle-docker-plugin: new gradle plugin syntax not working

I switch from old to “new” gradle plugin syntax.

plugins {
    id 'base'
    id 'com.diffplug.gradle.spotless' version '3.0.0' apply false
    id 'org.sonarqube' version '2.2.1' apply false
    id 'org.springframework.boot' version '1.5.1.RELEASE' apply false
    id 'com.jfrog.bintray' version '1.7.3' apply false
    id 'org.ajoberstar.github-pages' version '1.5.1' apply false
    id 'org.asciidoctor.gradle.asciidoctor' version '1.5.1' apply false
    id 'com.sourcemuse.mongo' version '0.14.0' apply false
    id 'com.bmuschko.docker-remote-api' version '3.0.3' apply false
}
...

When executing the docker tasks I always get the following error. The same error was also described in #280 scenario file5.gradle, but the issue was closed due to resolving another bug described in there.

How can I fix my build to use the new syntax?

build log: https://gist.github.com/matthiasbalke/fec93a4be79a0ae49163c832ebe14f67

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

OK, as reported by @bmuschko using the plugin syntax:

plugins {
  id "XXX" version "YYY" apply false
}

in the root project and in the subproject using old syntax with classname (no qoutes) works fine:

buildscript {
  repositories {
      jcenter()
  }
  dependencies {
      classpath group: 'ZZZ', name: 'XXXX', version: 'YYY'
  }
}

apply plugin: com.bmuschko....Plugin

works just fine!

@bmuschko In one of my projects (https://github.com/reflectoring/infiniboard) I want to switch to the new gradle plugin syntax, as it is said to be more performant.

When using the gradle-docker-plugin (here) I need to import the Task class com.bmuschko.gradle.docker.tasks.image.DockerBuildImage to be able to define some tasks to create and tag docker images within my release process. I didn’t find any solution to use this class without defining the plugin again within the buildscript block. This is why I am mixing the new and the old plugin definition style.

I really appreciate any hint on how to solve this problem.

@matthiasbalke this is the same issue as in #248 (see my comment).

To fix just adjust build script classpath, see my PR to your project.