Gradle 6.5.1: 'Could not find any convention object of type JavaPluginConvention'
See original GitHub issueEnvironment: 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.
- Create a Gradle springboot project running 2.2.2.RELEASE
- Add
id "com.google.cloud.tools.jib" version "2.4.0"
tobuild.gradle
:plugins
- 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
It looks like you’re applying the jib plugin on the root project (which as far as I can tell, you don’t want).
You root
build.gradle
could do something likeThe error is just saying that the project you are applying jib on doesn’t have the
java
plugin applied (since that’s only applied on subprojects).@onpaws I see that you’ve put a 👍 on the answer. I will close this issue for now. Please reopen if this issues persists or create a new issue if you encounter something new.