Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new gradle plugin syntax not working #347

Closed
matthiasbalke opened this issue Feb 15, 2017 · 15 comments
Closed

new gradle plugin syntax not working #347

matthiasbalke opened this issue Feb 15, 2017 · 15 comments
Assignees
Labels

Comments

@matthiasbalke
Copy link

matthiasbalke commented Feb 15, 2017

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

@cdancy
Copy link
Collaborator

cdancy commented Feb 15, 2017

@matthiasbalke looks more like a gradle issue than anything to do with this plugin. What version of gradle are you using to get this failure? Have you tried the latest and greatest? Do you have a small reproducible script I could give a go?

@orzeh
Copy link
Collaborator

orzeh commented Feb 15, 2017

@matthiasbalke how do you apply plugin to subprojects?

@matthiasbalke
Copy link
Author

@cdancy I'm using Gradle 3.3 this is my https://github.com/matthiasbalke/infiniboard/blob/gradle/build.gradle

The same error was also described in #280 scenario file5.gradle I think that should work as a minimal example to reproduce.

@orzeh Thats how I apply the plugin

@matthiasbalke
Copy link
Author

matthiasbalke commented Feb 16, 2017

@orzeh I just realized the given example is not the exact same setup, so I build a minimal example setup here https://github.com/matthiasbalke/gradle-docker-plugin-issue-347
I reproduced this issue on Mac OS X 10.10.5 and on ubuntu 14.04 using circleci.com.

@orzeh
Copy link
Collaborator

orzeh commented Feb 17, 2017

@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.

@matthiasbalke
Copy link
Author

@orzeh ok this is working for two plugins, but in case I use a bunch of plugins, do I have to include all plugins in the classpath block?

@orzeh
Copy link
Collaborator

orzeh commented Feb 21, 2017

@matthiasbalke you have to add all of them, I'm afraid 😞

@bmuschko
Copy link
Owner

@matthiasbalke Why do you declare apply false for your plugins? You will want to apply those plugins and not just add them to the build script's classpath. All the logic implemented in the plugins will not apply otherwise.

@orzeh
Copy link
Collaborator

orzeh commented Feb 24, 2017

@matthiasbalke
Copy link
Author

@bmuschko I have a multi module build and apply the plugins just to a subset of the modules.

@bmuschko
Copy link
Owner

@matthiasbalke You are actually describing two different use cases here:

  1. You use the new plugin DSL in the root project with apply false. In the subprojects you apply the plugin.
  2. In the other example you provide you mix the new plugin DSL and the buildscript notation in combination of a script plugin.

Can you describe what you are trying to solve or are these just different attempts to solve a specific problem?

Generally speaking the issue you are seeing occurs if you do not apply the remote API plugin. It's is required to properly set up the classpath of Docker Java. Just adding the plugin to the buildscript's classpath does not work even if you just want to add a task of a type provided by the plugin.

@matthiasbalke
Copy link
Author

@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.

@typekpb
Copy link

typekpb commented May 11, 2017

@matthiasbalke I ran into same problem (just different plugin: id "com.bmuschko.cargo-base" version "2.2.3")
@bmuschko ideas?

@typekpb
Copy link

typekpb commented May 11, 2017

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!

@cdancy
Copy link
Collaborator

cdancy commented Aug 18, 2017

Closing. Feel free to re-open if need be.

@cdancy cdancy closed this as completed Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants