Skip to content

build: support running Maven with -T1C - #2407

Merged
jaydeluca merged 3 commits into
prometheus:mainfrom
Stephan202:improvement/support-concurrent-builds
Aug 24, 2026
Merged

build: support running Maven with -T1C#2407
jaydeluca merged 3 commits into
prometheus:mainfrom
Stephan202:improvement/support-concurrent-builds

Conversation

@Stephan202

Copy link
Copy Markdown
Contributor

These two changes enable reliably building multiple Maven modules concurrently with mvn -T. On my laptop -T1C reduces mvn clean install build time from 04:03 to 01:29 minutes.

Summary of changes:

  • Declare missing Maven reactor dependencies, so that a concurrent build doesn't attempt to build modules for which (implicit) dependencies aren't built yet.
  • Make sure that ExemplarTest can be executed twice concurrently (once against the shaded artifact). This change also allows one to build the project on a machine that actually runs an OLTP collector.

The changes are split across two commits with suitable commit messages, so that rebase-and-merge is possible.

Several `integration-tests` modules consume the output of other reactor
modules without declaring a dependency on them. Maven derives the
reactor build order solely from directly declared dependencies, so it
does not know that those modules must be built first; serial builds
happen to work only because of the module ordering. As a result `mvn
-T1C package` races, and `mvn -pl <module> -am` leaves the producing
modules out of the reactor altogether.

`it-spring-boot-smoke-test` receives `prometheus-metrics-core` only
transitively, through `micrometer-registry-prometheus`, so neither `mvn
-T1C package` nor `mvn -pl integration-tests/it-spring-boot-smoke-test
-am` resolves the snapshot. The dependency is declared with the
exclusion that `micrometer-registry-prometheus` applies, leaving the
resolved set of artifacts, their versions and their scopes unchanged.

`it-exporter-test` and `it-no-protobuf-test` run their sample
applications from the shaded jars that the `it-exporter-*-sample` and
`it-exporter-no-protobuf` modules leave in `target`, a dependency that
`ExporterTest` expresses only as a relative filesystem path. The sample
modules are therefore declared as test dependencies.

Signed-off-by: Stephan Schroevers <stephan.schroevers@teampicnic.com>
Port 4317 is the default OTLP port, so this test fails on any machine
that runs a collector. It also collides with itself:
`prometheus-metrics-exporter-opentelemetry-shaded` compiles and runs
this module's test sources, so the test executes twice per build,
concurrently under `mvn -T`.

Signed-off-by: Stephan Schroevers <stephan.schroevers@teampicnic.com>
@Stephan202 Stephan202 changed the title Support running Maven with -T1C build: support running Maven with -T1C Aug 21, 2026
@jaydeluca
jaydeluca requested a lite review from Copilot August 24, 2026 12:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables reliable multi-threaded (mvn -T, e.g. -T1C) reactor builds by making module build order explicit where Maven can’t infer it from transitive or “side-effect” dependencies, and by removing a fixed-port test dependency that prevents concurrent execution.

Changes:

  • Updated ExemplarTest to use WireMock’s runtime-provided base URL (dynamic port) instead of a fixed 4317, allowing concurrent runs.
  • Added explicit reactor dependencies in integration-test modules so Maven can derive correct build order under -T and when using -am.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
prometheus-metrics-exporter-opentelemetry/src/test/java/io/prometheus/metrics/exporter/opentelemetry/ExemplarTest.java Switch WireMock setup to dynamic port via WireMockRuntimeInfo to avoid fixed-port conflicts in concurrent builds.
integration-tests/it-spring-boot-smoke-test/pom.xml Explicitly declares prometheus-metrics-core (with matching exclusion) to ensure correct reactor ordering under parallel builds.
integration-tests/it-exporter/it-no-protobuf-test/pom.xml Adds explicit dependency on the sample module that produces the shaded jar used by the IT, ensuring correct reactor ordering.
integration-tests/it-exporter/it-exporter-test/pom.xml Adds explicit dependencies on exporter sample modules so their shaded jars are built before the ITs that execute them.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jaydeluca
jaydeluca enabled auto-merge (squash) August 24, 2026 12:44
@jaydeluca
jaydeluca merged commit 6f88666 into prometheus:main Aug 24, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants