Skip to main content

Why quarkus:dev ignored gRPC settings in application.properties

Updated 6 min readMarkdown
Why quarkus:dev ignored gRPC settings in application.properties

Picture a cook who starts on a dish before anyone has put the recipe card on the counter. Nothing burns. The cook just makes something plain, because the instructions weren't there yet. Quarkus dev mode was doing roughly that with one line in a settings file.

Quarkus is a Java framework for building web services, and its dev mode (mvn quarkus:dev) runs your app and reloads it as you edit. In issue #57633, yersan reported that a gRPC setting was ignored in dev mode. I fixed it in quarkusio/quarkus#57866, and one review question on the way made the fix simpler.

What the user saw

gRPC is a way for services to call each other. You describe the messages in .proto files, and a generator turns them into Java classes. Quarkus can pick up .proto files that live inside a dependency, a library your project pulls in. You switch that on with one line in application.properties, the app's settings file:

quarkus.generate-code.grpc.scan-for-proto=<groupId>:<artifactId>

With mvn clean quarkus:dev, no gRPC classes appeared. With mvn clean compile quarkus:dev, they did. And yersan had already spotted the reason in the build log:

[INFO] Invoking quarkus:3.40.1.1:generate-code (default-generate-code) @ app
[INFO] Invoking resources:3.3.1:resources (default-resources) @ app

The first line is code generation. The second copies application.properties into target/classes, the build output folder where the generator reads its settings. So the generator went looking before the file had arrived.

A little Maven first

Maven is the build tool underneath. It splits a build into named stages called phases, such as process-resources (copy files like application.properties into place) and compile. Each phase runs one or more small jobs called goals, and goals come from plugins.

A project's pom.xml says what kind of project it is, its packaging. A Quarkus app can use <packaging>quarkus</packaging>, which comes with a built in recipe, called a lifecycle mapping, saying which goals run in which phase. It puts two goals in process-resources: first resources:resources, then quarkus:generate-code.

When two goals share a phase, Maven needs a rule for who goes first. It gives each goal from the recipe a priority number based on its place in the recipe, and the lower number runs first. Only when two numbers are equal does it fall back to the order the plugins appear in the build.

Reproducing it

I made a small app with the quarkus packaging and ran mvn clean quarkus:dev on unchanged main. Same log as the issue: generate-code before resources. Then I ran plain Maven on the same app, mvn clean process-test-resources, with no dev mode involved. Maven got it right: resources, then generate-code, then compile, and the test steps in the right order too. So only dev mode had it wrong.

Why it happened

Dev mode doesn't hand those early phases to Maven. It runs their goals itself, collecting them per phase by walking through the project's plugins in the order they're declared.

That's where the priority rule went missing. Your pom.xml names quarkus-maven-plugin directly, while Maven adds the resources plugin on its own, and it comes later in that walk. Dev mode used only the walking order, so generate-code went first. The test side had the same problem: generate-code-tests ran before testResources.

The fix

I could have special cased gRPC. But dev mode is doing Maven's job here, so the cleaner fix was to follow Maven's rule. After collecting the goals, dev mode now sorts each phase by priority:

static void sortByPriority(List<PluginExec> executions) {
    executions.sort(Comparator.comparingInt(pe -> pe.execution.getPriority()));
}
phaseExecutions.values().forEach(DevMojo::sortByPriority);

The first part orders a list by each goal's priority number, and the second runs it on every phase. Java's List.sort is stable, which means items with equal numbers keep the order they were already in. Think of boarding a plane by group: group 1 boards before group 2, but inside a group people still go in the order they're standing in line. So goals you declare yourself don't swap places with each other.

There was one more case. A project can also list generate-code in its pom.xml without naming a phase. Dev mode then puts a copy of it into compile, where it has to run before anything gets compiled, and it used to insert that copy at the very front of the list. With sorting, the position in the list stops mattering, so I gave the copy the smallest number a Java int can hold, Integer.MIN_VALUE. My first version did both: the small number and the insert at the front.

I added a unit test that builds the process-resources goals the way Maven creates them for this packaging, plus a made up user plugin, and expects resources, then code generation, then the user plugin after sorting. When I emptied sortByPriority so it did nothing, the test failed with code generation in first place. With the fix, dev mode on my app ran resources, generate-code, compile, testResources, generate-code-tests, testCompile, and a project that lists the goals without a phase kept its old order.

What review changed

cescoffier pointed at the line that inserted the copy at the front and asked: "Why keep the index here?"

Honestly, there was no reason anymore. The smallest priority already sorted the copy first, so the insert was a second mechanism doing the same job. I removed it for both the main and test copies, so the priority alone decides:

// the lowest priority sorts it before the compile phase goals
clone.setPriority(Integer.MIN_VALUE);
phaseExecutions.computeIfAbsent("compile", k -> new ArrayList<>())
        .add(new PluginExec(p, goalPrefix, clone));

I also added a second test that adds the copy last, after the compile goal and one more goal, and checks that it still comes out first.

gsmet approved. Then aloubyansky asked the other half of the question: why set a specific priority at all?

Without it, the copy keeps the priority of the goal it was copied from, which is 0 unless configured, like most goals. Because the sort is stable, the copy would then run after any compile goal listed before it, and compiling could start before the generated code exists. Plain Maven never hits this, since it runs code generation in earlier phases. Dev mode is what moves the copies into compile and test-compile, so the smallest number keeps them first there. That question got an answer in the thread, not a code change.

aloubyansky approved and merged it on 5 November 2026. Thanks cescoffier, gsmet and aloubyansky.

What I'm keeping from this one

When my code redoes another tool's job, I should copy that tool's rule instead of patching the one case in the bug report. Maven's rule fixed the test goals for free.

"Why keep the index here?" is now a question I ask myself. When two things do one job, one of them should go.

Have you ever seen dev mode and a normal build in your project do things in a different order? I'd like to hear how you tracked it down.

About the author

  • I contribute to open source developer tools: Tauri, Biome, oxc, Julia, Quarkus, Grafana, Burn and a few more. I start from an issue I can reproduce and a test that fails, then fix it. Here I write up the ones worth telling: what broke, why, and how the fix got through review.

No comments yet. Be the first to comment.