---
name: "Maven"
description: "Builds and tests a Java project using Maven and uploads a JAR artifact."
author: "buildkite"
repo: "maven-example"
stars: 6
demo: "https://buildkite.com/buildkite/maven-example/builds/latest?branch=main"
---

# Buildkite Maven Example


This repository is an example of testing and packaging a [Maven](http://maven.apache.org) project using [Buildkite](https://buildkite.com).
It demonstrates how to run unit tests, build a JAR file, and upload it as a [Buildkite artifact](https://buildkite.com/docs/builds/artifacts).



See the full [Getting Started Guide](https://buildkite.com/docs/guides/getting-started) for step-by-step instructions on how to get this running.


<a href="https://buildkite.com/buildkite/maven-example/builds/latest?branch=main">
  <img width="2400" alt="Screenshot of example pipeline build page" src="https://raw.githubusercontent.com/buildkite/maven-example/main/.buildkite/screenshot.png" />
</a>

<!-- docs:start -->

## How it works

This example:
- Uses Maven to run unit tests and build a JAR package
- Uploads the JAR file as a [Buildkite artifact](https://buildkite.com/docs/builds/artifacts)
- Runs inside Docker using the [Docker Compose Buildkite Plugin](https://github.com/buildkite-plugins/docker-compose-buildkite-plugin), or on a local agent with `mvn` in your `$PATH`

It also works on the [Elastic CI Stack for AWS](https://github.com/buildkite/elastic-ci-stack-for-aws).

<!-- docs:end -->

## License

See [LICENSE.md](https://github.com/buildkite/maven-example/blob/HEAD/LICENSE.md) (MIT)