# Upgrade Gradle Dependencies Weekly for a Spring Boot App

Yes. Once a week an agent reads your Gradle build, bumps each library and plugin within the lines your tests accept, runs the suite and opens a PR with every hold.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-gradle-dependencies/gradle/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads the build before it bumps anything. In a Gradle project like gothinkster/spring-boot-realworld-example-app, `build.gradle` applies `org.springframework.boot` 2.6.3, `io.spring.dependency-management` 1.0.11.RELEASE, the Netflix DGS codegen plugin 5.0.6 and Spotless 6.2.1, sets `sourceCompatibility = '11'`, and lists dependencies in three kinds: Boot starters with no version, which the dependency-management plugin resolves from the Boot BOM; libraries with an explicit version, such as `mybatis-spring-boot-starter:2.2.2`, `graphql-dgs-spring-boot-starter:4.9.21`, the three `jjwt` 0.11.2 artifacts, `joda-time:2.10.13` and `sqlite-jdbc:3.36.0.3`; and test libraries like REST Assured 4.5.1. `gradle/wrapper/gradle-wrapper.properties` pins Gradle 7.4. `.github/workflows/gradle.yml` runs `./gradlew clean test` on JDK 11 on every push and pull request, and the `clean` task deletes `dev.db`, the SQLite file `application.properties` points at. Twenty-three test classes cover the REST API with REST Assured's MockMvc module, the MyBatis repositories against the Flyway migration in `src/main/resources/db/migration`, and the JWT service.

Then it finds what moved. It runs `./gradlew dependencies --configuration runtimeClasspath` to see what the BOM resolved and queries Maven Central's metadata for each explicit coordinate and each plugin, then sorts the candidates into three groups. Patch and minor releases on the same major line are taken: the next Boot 2.x release, which moves every starter at once, and the current patch of each explicitly versioned library whose major is unchanged. Releases that cross a major line are held with the reason written down: Boot 3 needs Java 17 and the `jakarta` package rename, so it is a migration and not a weekly bump; a DGS major that requires a newer Boot line than the project runs is held with it; a REST Assured major that changes the Groovy it ships waits for its own change. The Gradle wrapper moves to the latest release of the line the Boot plugin supports, through `./gradlew wrapper --gradle-version` so the checksum and scripts update together.

Every bump is checked by the build. The agent installs JDK 11, the one `sourceCompatibility` and the workflow name, runs `./gradlew clean test` after the group of safe bumps, and when a test fails it bisects by reverting one coordinate at a time until the suite is green, moving the offender to the held list with the failing test's name. It also runs `./gradlew spotlessCheck`, since Spotless enforces google-java-format on every Java file and a formatter upgrade can change what it accepts, and `./gradlew generateJava` to confirm the DGS codegen still produces the GraphQL types from `src/main/resources/schema`.

What it does not touch is the workflow's own actions, `actions/checkout@v2`, `setup-java@v2` and `cache@v2`: those are a separate change to the CI file, and the pull request says so rather than mixing them in.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Upgrade the Gradle dependencies of this Spring Boot project. Read build.gradle, gradle/wrapper/gradle-wrapper.properties, the GitHub workflow and application.properties first, and note which versions come from the Spring Boot BOM and which are explicit. Run ./gradlew dependencies to see what resolves today, then look up the current release of each plugin and explicit coordinate on Maven Central. Take patch and minor releases within the current major line of each library and of Spring Boot; hold anything that crosses a major line or needs a newer Java or Boot than the project runs, with the reason. Move the Gradle wrapper with the wrapper task. Install the JDK the build targets and run ./gradlew clean test, spotlessCheck and generateJava; if a test fails, revert bumps one at a time until it passes and hold the one that broke it, naming the test. Do not edit the workflow's actions. Open a pull request with a table of every coordinate: before, after or held, and why.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

A pull request that changes `build.gradle` and the two wrapper files, with a table of every plugin and coordinate: the version before, the version after, or `held` with the reason and the failing test when there was one. The description quotes the final lines of `./gradlew clean test`, `spotlessCheck` and `generateJava` from the run, so the workflow is expected to pass on the same commands.

A reviewer checks the held list first, because that is where the decisions are: a Boot 3 migration, a DGS line that waits for it, and any library whose new patch broke a test. Merging takes the safe bumps now; the holds are the input to the next change.

## Run it on every Monday morning

An automation in the Project that holds the repository takes a `schedule` trigger with `cron` set to Monday at 09:00 in the team's `timezone` and this prompt. Its runs are read-only, so each one resolves the build, runs the suite against the candidate versions in its own sandbox and answers with the table of bumps and holds, which the console or `GET /o/{org}/sessions/{id}` shows, and pushes nothing. When the table shows bumps worth taking, a handler on the team's own server starts the run that writes the pull request, sending this body with a `request_id` that is a UUID v5 of the week's date, so a second start in the same week returns the run already started.

A team with several Gradle services runs one automation per repository's Project, each with its own cap on runs per hour, so a service still on an older Boot line gets its own held list rather than someone else's.

## Why run it on Rush?

A dependency bump is only safe once the test suite has run against it, and here that means a JDK, a Gradle wrapper download, Flyway migrating a fresh SQLite file and REST Assured driving the API, repeated for every candidate that fails. The agent does all of it in its own sandbox and keeps every command and its output in the run's record, so the pull request's table is backed by runs, not by a changelog reading.

The same run fits any Gradle build: a Kotlin DSL project, a multi-module build with a version catalog, a library published to Maven Central. Each gets the lines its own build and tests accept, and a held list specific to it.

## Frequently asked questions

### Why not move to Spring Boot 3 in the same run?

Boot 3 needs Java 17 and renames every `javax` import to `jakarta`, which touches the source, the MyBatis and DGS versions and the CI's JDK. That is a migration with its own tests, so the weekly run holds it and names it; a separate run can do it on its own branch.

### What happens when a bump breaks a test?

The run reverts one coordinate at a time until `./gradlew clean test` passes, then lists the coordinate as held with the failing test's name and the assertion. The green suite output in the run's record is for the versions the pull request actually contains.

### Does it update the Gradle wrapper?

Yes, through `./gradlew wrapper --gradle-version`, which rewrites `gradle-wrapper.properties`, the wrapper jar and the scripts together, staying on the line the Spring Boot plugin supports. A wrapper that no longer runs the build counts as a failure and is held.

### Why does it leave the GitHub Actions versions alone?

They are CI configuration, not build dependencies, and a bump there changes the runner's Node version rather than the application. Keeping them out of the pull request keeps the diff reviewable; a separate run can update the workflow.

## More Gradle jobs

- [Add CodeQL Scanning to a Gradle Project](https://getrush.ai/run/add-codeql-scanning/gradle/)
- [Enable the Gradle Configuration Cache for a Spring Boot Build](https://getrush.ai/run/add-configuration-cache/gradle/)
- [Add Dependabot to a Gradle Project](https://getrush.ai/run/add-dependabot/gradle/)

## The same job on other stacks

- [Upgrade Ktor and Gradle Dependencies](https://getrush.ai/run/upgrade-gradle-dependencies/ktor/)

## More jobs like this: Upgrade dependencies weekly

- [Upgrade graphql-js in a GraphQL API](https://getrush.ai/run/upgrade-graphql-js/graphql/)
- [Upgrade Hex Dependencies in a Phoenix App](https://getrush.ai/run/upgrade-hex-dependencies/phoenix/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
