Gradle

Gradle: Start the three steps of a Java build by hand, then the same build with one command Open { } Gradle: Build scripts properties, closures as blocks, plugins {} and repositories {} in a build script Open Gradle: Tasks gradle tasks, gradle tasks --all and gradle help --task Open Gradle: Java builds compileJava, test, jar, build and clean, and what each one depends on Open Gradle: Dependencies implementation, api, testImplementation, runtimeOnly and compileOnly, and the class path of each Open Gradle: Testing the JUnit dependencies Gradle 9 needs and a first passing test Open Gradle: Structure include, three projects and the task order of one build Open Gradle: Around the build a plugin in buildSrc, with its own tests, and CodeNarc passing on its source Open

All articles

About the course

Gradle reads a build script written in Groovy or Kotlin, works out which tasks have to run and in which order, and runs them: it compiles the code, runs the tests, writes the jar, publishes it to a repository. The course below is a chain of numbered lessons: each one takes a piece of the tool, shows the file it lives in, runs the commands and prints what they printed. Read them in order; every lesson names the one before it and the one after it.

Every command was run in this container with Gradle 9.9.2 on Java 21.0.13, with no network: the builds resolve their dependencies from the local Maven repository, and a lesson that needs a remote repository shows the failure it gets instead of pretending it works. The commands carry --offline --no-daemon --console=plain, which is how the image runs a build. Gradle prints two lines about its single-use daemon before every build here and a build time after it; the output blocks are excerpts and leave those lines out, the task lines stay as printed. Your times differ.

The Maven course covers the other build tool of the JVM, and one lesson of this course runs both of them on the same project.

Related