Slackbot
11/04/2022, 5:24 PMChris Lee
11/04/2022, 5:35 PMTaylor Smith
11/04/2022, 5:43 PMrootProject
without requiring much other configuration for things like dependency resolution or docker builds, which is why I'm attempting to use subprojects.Taylor Smith
11/04/2022, 5:43 PMproject
qualifier, still getting the same results.Taylor Smith
11/04/2022, 5:44 PMTaylor Smith
11/04/2022, 5:48 PMsubprojects
block, and it IS defined.
This makes me think that setProperty
isn't being evaluated before dependencies are pulled.Taylor Smith
11/04/2022, 6:02 PMVampire
11/04/2022, 7:55 PMsubprojects { ... }
or allprojects { ... }
is a code smell and should be avoided. It introduces project coupling, preventing more sophisticated Gradle features and also makes builds much harder to understand and maintain.
Just copying a cross-configuration block from root project into a plugin is not worth being called convention plugin. They should be applied directly where their effect is intended, so in each project where it should have effect explicitly.Taylor Smith
11/04/2022, 10:20 PMTaylor Smith
11/04/2022, 10:21 PMChris Lee
11/04/2022, 10:22 PMTaylor Smith
11/04/2022, 10:23 PMsubprojects
usageTaylor Smith
11/04/2022, 10:23 PMChris Lee
11/04/2022, 10:23 PMChris Lee
11/04/2022, 10:24 PMTaylor Smith
11/04/2022, 10:24 PMTaylor Smith
11/04/2022, 10:24 PMTaylor Smith
11/04/2022, 10:25 PMTaylor Smith
11/04/2022, 10:25 PMTaylor Smith
11/04/2022, 10:25 PMChris Lee
11/04/2022, 10:25 PMTaylor Smith
11/04/2022, 10:26 PMapply false
Taylor Smith
11/04/2022, 10:26 PMconfigure<JibExtension>
and excluding it from plugins{}
block, mysteriously worksTaylor Smith
11/04/2022, 10:26 PMVampire
11/04/2022, 10:49 PMTaylor Smith
11/04/2022, 10:49 PMVampire
11/04/2022, 10:49 PMVampire
11/04/2022, 10:50 PMTaylor Smith
11/04/2022, 10:50 PMVampire
11/04/2022, 10:50 PMTaylor Smith
11/04/2022, 10:50 PMTaylor Smith
11/04/2022, 10:51 PMimport com.google.cloud.tools.jib.gradle.JibExtension
Vampire
11/04/2022, 10:51 PMTaylor Smith
11/04/2022, 10:51 PMVampire
11/04/2022, 10:53 PMTaylor Smith
11/04/2022, 10:53 PMTaylor Smith
11/04/2022, 10:53 PMVampire
11/04/2022, 10:54 PMTaylor Smith
11/04/2022, 10:54 PMVampire
11/04/2022, 10:55 PMTaylor Smith
11/04/2022, 10:56 PMsubprojects
Taylor Smith
11/04/2022, 10:56 PMpackage com.vyrl
import com.google.cloud.tools.jib.gradle.BuildImageTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.named
class JibConfigPlugin : Plugin<Project> {
override fun apply(project: Project) {
val image: String = "<http://1223356.dkr.ecr.us-west-2.amazonaws.com/company/${project.rootProject.name}-${project.name}|1223356.dkr.ecr.us-west-2.amazonaws.com/company/${project.rootProject.name}-${project.name}>"
println("Setting image to: $image")
project.pluginManager.withPlugin("com.google.cloud.tools.jib") {
project.tasks.named<BuildImageTask>("jib") {
to {
setTargetImage(image)
}
}
}
}
}
Taylor Smith
11/04/2022, 10:56 PMapply false
wasn't taking effectTaylor Smith
11/04/2022, 10:57 PMTaylor Smith
11/04/2022, 10:58 PMMissing target image parameter, perhaps you should add a 'jib.to.image' configuration parameter to your build.gradle or set the parameter via the commandline (e.g. 'gradle jib --image <your image name>').
Taylor Smith
11/04/2022, 10:58 PMTaylor Smith
11/04/2022, 10:58 PMconfigure<JibExtension>
Taylor Smith
11/04/2022, 10:59 PMTaylor Smith
11/04/2022, 10:59 PMTaylor Smith
11/04/2022, 10:59 PMTaylor Smith
11/04/2022, 11:03 PMVampire
11/04/2022, 11:05 PMTaylor Smith
11/04/2022, 11:06 PM