Inspiration

Quarkus is a framework for writing Java web services. Its dev mode, started with mvn quarkus:dev, keeps the app running while the code changes. In issue #57633, yersan showed that dev mode ignored quarkus.generate-code.grpc.scan-for-proto in application.properties, so no gRPC classes were generated from .proto files in a dependency. Adding compile before quarkus:dev made the classes appear. The issue's log already showed generate-code running before resources.

What it does

The merged change, quarkusio/quarkus#57866, makes dev mode run Maven goals that share a phase in Maven's own priority order. Results:

  1. resources:resources now runs before quarkus:generate-code, so application.properties is in target/classes when the generators read their configuration.
  2. testResources now runs before generate-code-tests, the same fix on the test side.
  3. A project that declares generate-code without a phase still gets it scheduled first in compile, as before.

How I built it

I reproduced the bug on a small app with <packaging>quarkus</packaging>. Dev mode ran generate-code before resources, while plain Maven (mvn clean process-test-resources) ran them the other way round.

In Maven, a phase is a stage of the build and a goal is one job in it. The quarkus packaging binds both goals to process-resources, and Maven orders them by a priority number taken from that binding. Dev mode collects the goals itself, in plugin declaration order, and never looked at priority. The fix sorts each phase after collecting:

phaseExecutions.values().forEach(DevMojo::sortByPriority);

sortByPriority uses List.sort, which is stable, so goals with equal priority keep their declaration order. I added DevMojoTest with two unit tests: one for the quarkus packaging case, and one that adds the lowest priority execution last and checks it still sorts first. With the sort turned into a no op, the first test failed.

Challenges I ran into

The phaseless generate-code case. Dev mode copies that goal into compile and used to insert it at the front of the list. Once the list is sorted, position no longer counts, so the copy now gets Integer.MIN_VALUE as its priority. My first version kept the front insert as well. In review, cescoffier questioned that index, and I removed it so the priority alone decides. aloubyansky asked why a specific priority was needed; I explained that without it, the copy would share priority 0 with most goals and could run after compile goals declared earlier, before its sources exist.

Accomplishments that I'm proud of

A general fix that follows Maven's rule instead of special casing gRPC, which also fixed the test goals. Approved by gsmet and aloubyansky, merged by aloubyansky on 5 November 2026.

What I learned

When code takes over a job from another tool, its behaviour should match that tool's rules, not only the case in front of you. And a reviewer asking why a line is still there is often pointing at something that can be removed.

What's next

Nothing is left open from this PR. The habit I'm carrying forward: when I touch code that runs Maven goals itself, I'll compare its order with a plain Maven run on the same project first.

The full story, with all the code, is on my blog: https://ashokramsi.hashnode.dev/quarkus-dev-mode-goal-order

Built With

Share this project:

Updates