Skip to content

build: support running Maven with -T1C - #2407

Open
Stephan202 wants to merge 2 commits into
prometheus:mainfrom
Stephan202:improvement/support-concurrent-builds
Open

build: support running Maven with -T1C#2407
Stephan202 wants to merge 2 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
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.

1 participant