# Set Up Dependabot for a Maven Project

Yes. An agent writes a dependabot.yml for your Maven build, its Gradle twin and your workflows, with groups and the ignores your pom already asks for, in a PR.

[Run this on Rush](https://cloud.getrush.ai/run/add-dependabot/maven/). 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 writes the configuration, because a useful Dependabot setup encodes the project's own rules about what may move and what must not. In a project laid out like spring-projects/spring-petclinic, `.github/` holds `dco.yml` and three workflows but no `dependabot.yml` and no Renovate file. `pom.xml` inherits from `spring-boot-starter-parent` 4.1.0 and keeps every other version in a property: Checkstyle 12.3.1 with a comment that it must stay on 12 because 13 requires JDK 21 while the build targets Java 17, `nohttp-checkstyle` 0.0.11, `spring-javaformat` 0.0.47, JaCoCo 0.8.15, `maven-checkstyle-plugin` 3.6.0, the webjars for Bootstrap 5.3.8 and Font Awesome 4.7.0, and a `project.build.outputTimestamp` for reproducible builds. `build.gradle` declares the same tools a second time with its own plugin versions, `gradle/wrapper/gradle-wrapper.properties` pins Gradle 9.5.1 and `.mvn/wrapper/maven-wrapper.properties` pins Maven 3.9.16. The workflows mix `actions/checkout@v2` in `deploy-and-test-cluster.yml` with `@v4` elsewhere, `setup-java@v4`, `gradle/actions/setup-gradle@v4` and `helm/kind-action@v1`; `docker-compose.yml` runs `mysql:9.7` and `postgres:18.4`, and `k8s/` has two manifests.

The agent writes `.github/dependabot.yml` with three `updates` entries on a weekly schedule, each with a `commit-message` prefix and a `dependencies` label. The `maven` entry groups minor and patch updates into one pull request and keeps majors separate, so a Spring Boot major arrives alone; it ignores `com.puppycrawl.tools:checkstyle` at version 13 and above, with the same reason the pom gives, so the bot never proposes the upgrade the comment forbids. The `gradle` entry covers `build.gradle` and the wrapper with the same groups and the same ignore, since Gradle's `checkstyleVersion` is the same pin. The `github-actions` entry groups all action bumps into one pull request a week, which brings the `checkout@v2` in the cluster workflow up to the version the others use at the first run.

Because the Maven wrapper is `distributionType=only-script`, its version lives in `maven-wrapper.properties`, which the `maven` ecosystem does not update; the agent says so in the pull request and leaves it. The `spring-boot-starter-parent` is a parent, not a dependency, and Dependabot does update it, which is the one change a reviewer will want to see on its own. The agent does not add a `docker-compose` entry, since the two database images there are a local convenience rather than a shipped dependency, and mentions it as an option.

To check it, the agent installs Docker in its sandbox (`sudo apt-get install -y docker.io`, then starts `dockerd`), because the Dependabot CLI runs each ecosystem's updater in a container, and runs the configuration through that CLI for each ecosystem in dry-run mode, which reads `pom.xml`, `build.gradle` and the workflows and prints what the first pull requests would be: it pastes that list into the pull request so the team sees the first week's updates before enabling the bot, and confirms the Checkstyle ignore held by checking that version 13 does not appear in it. It validates the YAML against GitHub's schema and runs `./mvnw -B validate` to show the build is untouched.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Set up Dependabot for this Maven project. Read pom.xml, build.gradle, gradle/wrapper/gradle-wrapper.properties, .mvn/wrapper/maven-wrapper.properties, every workflow under .github/workflows/, docker-compose.yml and README.md first. Write .github/dependabot.yml with weekly maven, gradle and github-actions entries, each with a commit message prefix and a label; group minor and patch updates and leave majors separate for maven and gradle; group all action updates together; and add an ignore for any dependency the pom's own comments say must not move, with the same reason. Say in the pull request what the config cannot update (the Maven wrapper's distribution, the parent's majors only arrive alone) and what you left out and why. Run the Dependabot CLI in dry-run mode for each ecosystem in your sandbox and paste the list of updates it would open first, confirm the ignore held, validate the YAML, run ./mvnw -B validate, and open a pull request with the output.",
  "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

The pull request adds `.github/dependabot.yml` and changes nothing else. Its description shows the three ecosystem entries as written, the dry-run list of the first pull requests each would open, grouped as the configuration groups them, the Checkstyle versions that appeared and did not, the schema validation result, and the `validate` output.

Once merged, Dependabot opens its first pull requests on the next scheduled day: one grouped Maven update, one grouped Gradle update, one grouped actions update, and any major on its own. Each runs the existing `Java CI with Maven` and Gradle workflows, so a bump that breaks the build fails there, not after merging. The pom, the Gradle build and the wrappers are unchanged.

Before merging, a reviewer picks the day and time zone for the schedule, decides whether majors should be opened at all or ignored until someone asks, sets the open pull request limit per ecosystem, and checks the dry-run list for a dependency that should be pinned rather than bumped.

## Run it on every repository without an update bot

A team with several Java services sends this body once per repository to `POST /o/{org}/sessions`, each with its own repository in `resources` and a `request_id` that is a UUID v5 of the repository's full name, so a retried call returns the run already started instead of opening a second pull request. Each run reads its own build: a multi-module project gets one `maven` entry at the root, a project with a `Dockerfile` gets a `docker` entry, one that already has Renovate is left alone with a note, and one whose pom pins a dependency with a reason gets the matching ignore.

After the bot is on, the recurring job is reviewing what it opens. A `schedule` trigger on an automation, set to the morning after Dependabot's day, starts one run whose prompt asks the agent to go through each open Dependabot pull request, read the changelog of each bumped artifact, run the build, and leave a review that says what changed and whether the tests covered it. A pull request Dependabot opens fires no `github` trigger, since bot senders never do, and an automation run has its own `max_runs_per_hour` cap.

## Why run it on Rush?

A Dependabot file is short, and most of them are copied from a template that knows nothing about the project, so they open a Checkstyle 13 bump against a Java 17 build or forty separate pull requests in a week. The agent reads the pom's comments and the second build file, writes groups and ignores that match them, and shows the first week's pull requests from a dry run in its own sandbox before anyone turns the bot on.

The dry-run output, the schema check and the build stay with the run and are pasted into the pull request, so the review is about the schedule and the groups rather than a guess at what the bot will do. Several repositories can get a matching configuration at once, each with its own ignores.

## Frequently asked questions

### Will it update the Spring Boot parent?

Yes. Dependabot treats the parent POM as a dependency and proposes new versions. Minors and patches land in the weekly group; a major, which changes the Java baseline and many transitive versions, opens on its own so it can be planned.

### Why ignore Checkstyle 13?

The pom says so: Checkstyle 13 requires JDK 21 and the build targets Java 17, so the upgrade would fail every week. The ignore carries that reason, and it is one line to remove when the project moves to 21.

### Does it cover the Gradle build too?

Yes, with a `gradle` entry over `build.gradle` and the wrapper, using the same groups and the same ignore, so the two builds move together. A team that treats the Gradle build as secondary can drop that entry.

### What about the Maven wrapper version?

Dependabot's `maven` ecosystem updates dependencies and plugins in the pom, not the distribution the wrapper downloads, so `maven-wrapper.properties` stays as it is. The pull request says so and notes that `./mvnw wrapper:wrapper` updates it by hand.

## More Maven jobs

- [Write a Dockerfile for a Maven Spring Boot App](https://getrush.ai/run/add-dockerfile/maven/)
- [Add the Maven Enforcer Plugin to a Build](https://getrush.ai/run/add-enforcer-plugin/maven/)
- [Add Error Prone to a Maven Build](https://getrush.ai/run/add-errorprone/maven/)

## The same job on other stacks

- [Add Dependabot to a Medusa Monorepo](https://getrush.ai/run/add-dependabot/medusa/)
- [Add Dependabot to an Express and Mongoose API](https://getrush.ai/run/add-dependabot/mongoose/)
- [Add Dependabot to an Obsidian Plugin](https://getrush.ai/run/add-dependabot/obsidian-plugin/)

## 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/)
