Skip to content

Build from source

Full reactor in 25–30 minutes, compile-only in 3–5. Works on Linux, macOS, Windows. Restricted-network friendly.

Prerequisites

  • Java 21 — Temurin, Liberica, Corretto, or any 21 LTS distribution
  • Maven 3.9+ — or use the bundled ./mvnw wrapper (no install required)
  • Docker — only required for the Kubernetes E2E gate

Verify your environment:

java -version    # should report 21
./mvnw -v        # should report Maven 3.9+
docker info      # should connect to a running daemon

Standard build

git clone https://github.com/kzmlabs/flink-statefun.git
cd flink-statefun
./mvnw clean install

This builds every module and runs every test, including the K8s E2E gate (kind cluster + Flink Operator + Kafka + LocalStack + real integration tests). Total: ~25–30 min on a developer laptop.

Faster iteration

Skips kind-cluster provisioning + integration tests. Keeps unit tests.

./mvnw clean install -Dskip.k8s.e2e

~5–7 min

Compile + package only.

./mvnw clean install -DskipTests

~3–5 min

Builds the named module and the modules it depends on (-am).

./mvnw -pl :statefun-sdk-java -am verify

Re-run the E2E gate after a code change without rebuilding upstream modules.

./mvnw verify -pl :statefun-e2e-k8s-native -am -Dskip.teardown=true

-Dskip.teardown=true keeps the kind cluster after the test for kubectl debugging.

Restricted-network builds

Every Dockerfile and Kubernetes manifest in the build is parametric so you can pull base images through an internal registry mirror — no fork required.

export IMAGE_REGISTRY_PREFIX=harbor.example.com/dockerhub-proxy/
./mvnw clean install

The prefix is honoured by:

  • statefun-docker/src/main/docker/Dockerfile — the runtime distribution image
  • statefun-e2e-tests/statefun-e2e-k8s-native/remote-function/Dockerfile — the test fixture image
  • kafka.yaml and localstack.yaml k8s manifests applied during E2E setup

Default empty pulls directly from Docker Hub — no behaviour change for the typical case.

Code formatting

The project enforces Google Java Format (2-space indent) via Spotless:

./mvnw spotless:apply -pl <module>     # auto-fix
./mvnw spotless:check                   # CI gate — fails on drift

Run before committing — CI rejects formatting drift.

Contribution workflow

  1. Branch from release (the active development branch).
  2. Make changes; run ./mvnw spotless:apply and ./mvnw -Dskip.k8s.e2e install locally.
  3. Open a PR against release. CI runs the full K8s E2E gate, CodeQL, Scorecard, Trivy, and dep-convergence enforcer.
  4. Merge via the merge queue once green.

PR target branch

PRs targeting master are not accepted. master is a vestigial Apache fork pointer; all development happens on release.

Troubleshooting

Build fails on enforcer:dependencyConvergence

Two paths bring different versions of the same artifact onto the classpath. Add a pin in the root pom's <dependencyManagement> — see existing pins for commons-lang3, jsr305, flink-shaded-netty as templates.

K8s E2E hangs on kind create cluster

Docker is out of disk or the daemon is unresponsive. Check df -h, docker system df, and consider docker system prune -af --volumes.

mvn verify reports ClassNotFoundException after rebuild

Stale .m2 cache after a versions:set or large refactor. Force a fresh resolve:

./mvnw clean install -DskipTests -U

Next steps