Skip to content

Gradle 6.5.1: 'Could not find any convention object of type JavaPluginConvention' #2644

@onpaws

Description

@onpaws

Environment:
macOS, openjdk@11, SpringBoot 2.2.2.RELEASE

  • Jib version:
    2.4.0
  • Build tool:
$ gradle --version

------------------------------------------------------------
Gradle 6.5.1
------------------------------------------------------------

Build time:   2020-06-30 06:32:47 UTC
Revision:     66bc713f7169626a7f0134bf452abde51550ea0a

Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.8 (Oracle Corporation 11.0.8+11)
OS:           Mac OS X 10.15.6 x86_64

  • OS:
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15.6
BuildVersion:	19G73

Description of the issue:
Thanks for making Jib, it's a nice improvement over the naive Dockerizing a JAR approach I was heretofore using.

I recently inherited a Gradle project and trying to deploy it using Jib.
The trouble is, adding the Jib plugin and running it seems to fail, and I'm not sure what's wrong.
As I understand it, installing Jib (and most Gradle plugins) should usually be a matter of adding jib to the plugins section of the root build.gradle, like so:

plugins {
    id "net.ltgt.apt" version "0.20"
    id "io.spring.dependency-management" version "1.0.8.RELEASE"
    id "com.google.cloud.tools.jib" version "2.4.0"
}

However when I do that, gradle jib fails, in fact gradle by itself fails too. I added another plugin as an experiment (id "org.ajoberstar.pipeline-test" version "0.2.0-rc.13") and gradle still worked OK, so something about Jib seems to be a factor.

$ gradle

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'MyApplication'.
> Could not find any convention object of type JavaPluginConvention.

Meanwhile I was able to get Jib 2.4.0 working in a separate SpringBoot/Maven project, also Java 11, same machine, etc. So I suspect something related to Gradle+Jib interaction. Feels like it's probably not a Jib bug but something related to Gradle or perhaps this project. Not enough of a Java or Gradle expert to know what to do next...any tips would be appreciated. Thanks!

Expected behavior:
gradle jib --image=example should work in the usual way.

Steps to reproduce:
These repro steps are a 'best guess' b/c I am awaiting permission to share the source. I can, however, share the build.gradle and that's included below.

  1. Create a Gradle springboot project running 2.2.2.RELEASE
  2. Add id "com.google.cloud.tools.jib" version "2.4.0" to build.gradle:plugins
  3. Run gradle

build.gradle contents:

plugins {
    id "net.ltgt.apt" version "0.20"
    id "io.spring.dependency-management" version "1.0.8.RELEASE"
    id "com.google.cloud.tools.jib" version "2.4.0"
}

ext {
    springBootVersion = "2.2.2.RELEASE"
    testcontainers = "1.12.0"
}

subprojects {
    apply plugin: "java"
    apply plugin: "net.ltgt.apt-idea"
    apply plugin: "io.spring.dependency-management"

    dependencyManagement {
        imports { mavenBom("org.springframework.boot:spring-boot-dependencies:${springBootVersion}") }
    }

    group = "com.example.application"
    version = "2.1.0"
    sourceCompatibility = "11"
    targetCompatibility = "11"

    repositories {
        mavenCentral()
    }

    configurations {
        developmentOnly
    	runtimeClasspath {
    		extendsFrom developmentOnly
    	}
        compileOnly {
            extendsFrom annotationProcessor
        }
    }

    dependencies {
        compileOnly "org.projectlombok:lombok"
        testCompileOnly "org.projectlombok:lombok"
        annotationProcessor "org.projectlombok:lombok"
        testAnnotationProcessor "org.projectlombok:lombok"
    }
}

Log output:
If it's helpful please just ask, happy to provide.

Additional Information:
Convention object, JavaPluginConvention 🤔 not sure what that means...
https://docs.gradle.org/current/javadoc/org/gradle/api/plugins/JavaPluginConvention.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions