Importing plugins class from applied script does not work

(Bastien Arata) #1

I’m running a weird behaviour with gradle (multiproject wrapper):

my root build.gradle file

plugins {
    // Docker plugin
    id "de.gesellix.docker" version "2017-10-05T23-00-11"

a script helper java-docker.gradle

apply plugin: "de.gesellix.docker"

import de.gesellix.gradle.docker.tasks.DockerBuildTask
import de.gesellix.gradle.docker.tasks.DockerTask

task prepareDockerImage(type: DockerBuildTask, dependsOn: war) {
    // Task here

and my application build.gradle:

apply from: "${gradleDirPath}/java-docker.gradle"
apply from: "${gradleDirPath}/java-webapp.gradle"

dependencies {
    // App dependencies

when running ./gradlew help I run into :

unable to resolve class de.gesellix.gradle.docker.tasks.DockerTask
@ line 6, column 1.
import de.gesellix.gradle.docker.tasks.DockerTask


unable to resolve class
de.gesellix.gradle.docker.tasks.DockerBuildTask @ line 5, column 1.
import de.gesellix.gradle.docker.tasks.DockerBuildTask

I’ve tried to remove the apply from: "${gradleDirPath}/java-docker.gradle" from app build.gradle and to apply plugin and imports directly in app build.gradle, and this is working as expected.

Any idea why the import from an applied script fails ?