Streamlining Tasks in Java and Spring Boot with Compound Commands

In Java and Spring Boot, there’s no need to craft shell commands for some tasks. This capability proves incredibly handy. For instance, within your `build.gradle` file, you can define compound tasks. Here’s how you can set it up:

task buildAndRun {
dependsOn ‘clean’, ‘build’, ‘bootRun’

Then, to execute the task, simply run:

./gradlew buildAndRun

This approach streamlines your workflow, making development in Java and Spring Boot even more efficient.

Feel free to reach out to me on LinkedIn, which you can find below. Looking forward to connecting!



Tomoharu Tsutsumi

Software Engineer with 4 + years of professional experience.