Slackbot
07/16/2022, 4:09 AMJohn
07/16/2022, 4:12 AMJohn
07/16/2022, 4:15 AMgrossws
07/16/2022, 5:39 AMplugins { id("ws.gross.private-repo") version "0.15.0" }
privateRepo {
manifests {
create("build-logic") { from("com.example.gradle:manifest:x.y.z") }
}
}
which configures private nexus repository for plugins, dependency management and publishing, fetches manifest containing list of plugins and version catalogs and applies it allowing subproject/build.gradle.kts
to look like:
plugins {
id("com.example.java-library")
id("com.example.lombok")
}
dependencies {
implementation(commonLibs.guava)
testImplementation(testingLibs.mockito)
}
Last category of plugins we use is adhoc in a project separated into the in-project included build, for example for codegen exposing simple extension to configure it.
Fortunately it's all green field since we lived with Apache Maven (and Ant in some legacy apps) for years. And we are very small org.
So we try to have only project specific code in the build.gradle.kts
(at most plugins, dependencies, test suites dependencies and config via extensions). Not entirely clean, of course, things like adding --add-opens
to quarkusDev
task are not worth extracting them to convention plugin usually. Almost all projects are that way except abandoned/archived ones but 80-85% projects are still on maven.grossws
07/16/2022, 5:55 AMVampire
07/16/2022, 11:32 AMI'm just wondering how typical this is
I don't know how typical it is, but optimally all bigger builds should look like that. At least that is what is called an "idiomatic" build. :-) Our main build is far from that as it grew from pre-1.0 in an organic way, but I'm trying to clean up that mess. :-)
some pain if you want target several Gradle versions and want use new features if available (heil reflection/method handles)
Alternatively to reflection you could for Gradle <7 also check the version and have the version specific code in separate classes. And just in case you didn't know, since Gradle 7 you can asleep have different variants of the plugin that are selected automatically according to the consuming Gradle version. :-)
Thomas Broyer
07/16/2022, 11:49 AMbase
plugin setting up Ktlint through Spotless for the *.gradle.kts
, a java-base
one configuring a toolchain, JavaCompile options, Error Prone, Forbidden APIs, and Google Java Format through Spotless, and a dependency-management
plugin for logging-capabilities
and the like; and that's it). In terms of third-party plugins we almost always use: Spotless, ErrorProne and Nullaway, FlywayDB, logging-capabilities, Forbidden APIs, and CycloneDX, and sometimes Nebula packaging when we need Deb or RPM packages (we're slowly moving to separate debhelper and rpm steps though).
We do mostly zero-framework magnificent monoliths in Java with React or Vue SPAs and, for instance, we never call Node or Docker from Gradle; orchestration is done at the Jenkinsfile level (Node and Gradle in parallel for client and server, then Docker to package it all ; the Gradle build only prepares directories for the subsequent Docker build)John
07/16/2022, 2:05 PMJohn
07/16/2022, 3:14 PMVampire
07/16/2022, 3:53 PMgrossws
07/16/2022, 3:59 PMJohn
07/16/2022, 4:12 PMJohn
07/16/2022, 4:16 PMRyan Schmitt
07/18/2022, 7:44 PMWith Groovy or Kotlin there is too much shenanigans with compatibility and runtime versions and so on in that context.Is this true of Kotlin even with the classloader isolation provided by the
plugins
DSL block?Vampire
07/18/2022, 9:09 PMRyan Schmitt
07/18/2022, 11:44 PMVampire
07/19/2022, 12:44 AMRyan Schmitt
07/19/2022, 1:01 AMRyan Schmitt
07/20/2022, 12:39 AMDavid Lee
08/05/2022, 12:36 AMJohn
08/05/2022, 12:48 AMJohn
08/05/2022, 12:49 AMJohn
08/05/2022, 12:50 AMJohn
08/05/2022, 12:51 AMJohn
08/05/2022, 12:53 AMJohn
08/05/2022, 12:55 AMPaul Merlin
08/05/2022, 7:28 AMPaul Merlin
08/05/2022, 7:29 AMDavid Lee
08/06/2022, 7:16 PM