Skip to content

chore(build): generate a Jandex index in the Flow runtime modules instead of the aggregate flow-jandex artifact - #25899

Merged
mcollovati merged 11 commits into
mainfrom
chore/per-module-jandex-indexes
Sep 25, 2026
Merged

mcollovati merged 11 commits into
mainfrom
chore/per-module-jandex-indexes

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Each Flow runtime module now builds its own Jandex index (META-INF/jandex.idx) for its own classes. This replaces flow-jandex, a separate artifact that indexed classes from other jars. That artifact had to be kept in sync by hand and made Quarkus link classes to a jar that did not contain them.

What changed

Breaking: the com.vaadin:flow-jandex artifact is removed from the reactor and from flow-bom. Builds that declare it must drop the dependency, because the index now ships in the module jars. This affects only projects that use Flow outside the Vaadin Platform and depend on flow-jandex directly, such as Quarkus setups.

  • The parent pom.xml declares jandex-maven-plugin (3.6.0) once, for all modules. The new jandex.skip property defaults to false, so a new runtime module gets an index automatically.
  • Modules that Quarkus does not read set jandex.skip to true:
    • vaadin-spring and vaadin-cdi
    • the build tooling: flow-plugins, flow-build-tools, flow-devloop-daemon, flow-polymer2lit
    • modules that package only resources: flow-push, flow-client, flow-server-production-mode
    • the test utilities, and flow-tests, which passes the setting on to every integration test module
  • Modules that now carry an index include flow-server, flow-data, flow-html-components, flow-dnd and flow-lit-template. Also indexed are flow-react, flow-polymer-template, flow-webpush and vaadin-dev-server. The old aggregate did not include these four.
  • guidelines/repository.md removes flow-jandex from the module list and explains which modules have an index and why.

Each module now writes its own META-INF/jandex.idx, instead of relying on
flow-jandex, an aggregate artifact that indexed the classes of seven other
jars. That aggregate had to be kept in sync by hand - flow-react,
flow-polymer-template, flow-webpush and vaadin-dev-server were missing
from it - and it makes Jandex consumers attribute classes to an archive
that does not contain them, which is what the Quarkus extension works
around when it drops one of the overlapping Vaadin index artifacts.

flow-jandex is kept as an empty artifact so that builds declaring it keep
resolving.
The index is written at process-classes, before shade relocates the asm
and commons packages, so the shaded artifact would carry an index naming
classes that are no longer in it - the same reason the native-image
configs are already filtered out. The unshaded main artifact keeps its
index.
Comment thread flow-jandex/pom.xml Outdated
<packaging>jar</packaging>
<name>Flow Jandex index</name>
<description>Jandex index for flow packages for when the vaadin platform is not used</description>
<description>Deprecated and empty: every Flow module now carries its own Jandex index. Kept so that builds depending on this artifact keep resolving; remove the dependency.</description>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Delete the module

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done — the module is gone: directory deleted, dropped from the reactor in the root POM and from flow-bom, so com.vaadin:flow-jandex is no longer published. Builds that declare it have to remove the dependency and take the index from the module jars instead. The full reactor still builds, and guidelines/repository.md now documents that every module jar carries its own META-INF/jandex.idx.

One thing to be aware of before this is merged: dropping the artifact in a minor is a hard resolution failure, not a warning, for any build that still declares it — the Quarkus extension's integration tests do, for example. If you'd rather not break those mid-cycle, the alternative is to keep flow-jandex publishing an empty jar until 26; happy to restore that if you prefer.

Every module now carries its own META-INF/jandex.idx, so the aggregate
index artifact has nothing left to publish. The artifact is gone from the
reactor and from the BOM; builds that still declare com.vaadin:flow-jandex
have to drop the dependency, and get the index from the module jars
instead.
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 1 482 files  ±0   1 566 suites  ±0   1h 32m 31s ⏱️ - 1m 58s
12 118 tests ±0  12 050 ✅ ±0  68 💤 ±0  0 ❌ ±0 
12 471 runs  ±0  12 403 ✅ ±0  68 💤 ±0  0 ❌ ±0 

Results for commit 4b6b401. ± Comparison against base commit bb3033a.

♻️ This comment has been updated with latest results.

@Artur-
Artur- marked this pull request as ready for review September 24, 2026 07:30
Comment thread flow-build-tools/pom.xml Outdated
<!-- Dependency Maven metadata -->
<exclude>META-INF/maven/**</exclude>
<!-- Jandex index (references unshaded class names) -->
<exclude>META-INF/jandex.idx</exclude>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a jandex index that reference the correct class names?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

There wasn't — the exclusion alone left the shaded artifact with no index at all. Now there is one: a jandex-jar execution regenerates the index inside the shaded jar after shade has run, so every name in it is post-relocation. Checked on the built artifact: 136 classes indexed, 7 signature references to com.vaadin.frontendtools.internal.asm.*, and none to org.objectweb.asm or org.apache.commons.

The relocated copies of asm/commons themselves are excluded from the index — they're bundled internals rather than classes this module publishes, and indexing them too would grow the artifact by ~330 kB instead of the ~39 kB it costs now. Say the word if you'd rather index the whole jar.

totally-not-ai Bot and others added 2 commits September 24, 2026 10:36
The index the parent POM writes at process-classes names the unshaded
classes, so it is filtered out of the shaded artifact. Generate the index
into that jar once it is packaged instead, so its signatures name the
relocated asm and commons classes the jar actually contains. The
relocated copies themselves stay out of the index: they are bundled
internals, and indexing them would add some 330 kB to the artifact.
@mcollovati

Copy link
Copy Markdown
Collaborator

Test modules do not require a Jandex index to be created.
I'm also not 100% sure about vaadin-cdi and vaadin-spring: the main usage for the index nowadays is with the Quarkus extension.

Declare jandex-maven-plugin in pluginManagement and let the runtime
modules an application puts on its classpath opt in: flow-server,
flow-data, flow-html-components, flow-dnd, flow-lit-template,
flow-polymer-template, flow-react, flow-webpush and vaadin-dev-server.
Test and build-tool modules, vaadin-cdi and vaadin-spring have no Jandex
consumer, so they no longer carry an index. That also leaves the shaded
flow-build-tools jar without one, so its post-shade indexing goes away.
@totally-not-ai totally-not-ai Bot changed the title chore(build): generate a Jandex index in every module instead of the aggregate flow-jandex artifact chore(build): generate a Jandex index in the Flow runtime modules instead of the aggregate flow-jandex artifact Sep 24, 2026
@totally-not-ai

Copy link
Copy Markdown
Contributor Author

@mcollovati Agreed — the index is now opt-in. jandex-maven-plugin moved to the parent's pluginManagement, and only the runtime modules an application puts on its classpath declare it: flow-server, flow-data, flow-html-components, flow-dnd, flow-lit-template, flow-polymer-template, flow-react, flow-webpush and vaadin-dev-server. That's what the old flow-jandex aggregate covered plus the modules the Quarkus extension currently indexes explicitly via IndexDependencyBuildItem, and flow-webpush as the one remaining runtime component module.

Test modules, build tooling, vaadin-cdi and vaadin-spring no longer get an index (checked on a clean build: none in their jars). As a side effect the shaded flow-build-tools jar has no index at all any more, so the post-shade indexing added for it earlier is gone too. guidelines/repository.md now says a new runtime module declares the plugin to get one.

@Artur-

Artur- commented Sep 24, 2026

Copy link
Copy Markdown
Member

Wouldn't it be easier to use the skip property of jandex?

Declare jandex-maven-plugin once in the parent's plugins with jandex.skip
defaulting to true, and have the modules a Quarkus application loads set
it to false, instead of each of them declaring the plugin.
@totally-not-ai

Copy link
Copy Markdown
Contributor Author

@Artur- Yes, that's simpler — switched to it. The plugin is declared once in the parent's <plugins> again, jandex.skip defaults to true there, and the modules a Quarkus application loads set it to false: one property line each instead of a plugin block. I kept the default as skip, so test and tooling modules, including any added later, stay unindexed without having to remember to opt out. On a clean build the same nine jars carry an index as before, and the rest (vaadin-cdi, vaadin-spring, build tools, test utilities) have none.

Comment thread pom.xml Outdated
Default jandex.skip to false and set it to true in the modules without
a Jandex consumer: flow-tests (inherited by every integration test
module), flow-plugins, flow-build-tools, flow-devloop-daemon,
flow-polymer2lit, the test utilities, vaadin-cdi and vaadin-spring. A new
runtime module now gets an index without having to ask for one.
@sonarqubecloud

Copy link
Copy Markdown

@mcollovati

Copy link
Copy Markdown
Collaborator

I think we can merge this one. flow-jandex removal should only affects vaadin-quarkus and can be easily fixed (it's just a dependency removal).
A little bit more work needs to be done in the platform repo to exclude JARs containing the index from vaadin-core-jandex. We will remove or produce an empty index once all relevant projects are migrated to self-containing jandex.

Side note: jandex per artifact will also be helpful in the process of merging vaadin-quarkus into Flow codebase, because running quarkus:dev in test modules will find the proper indexes in the local folders.

I'll investigate what changes must be done in platform, then I think we can merge this and finalize with #25736

@totally-not-ai

Copy link
Copy Markdown
Contributor Author

@mcollovati Thanks. No code change for this one; a note for the follow-ups. On the vaadin-quarkus side, beyond dropping the flow-jandex dependency: the IndexDependencyBuildItem entries for flow-react, flow-polymer-template and vaadin-dev-server become redundant, because those jars now ship their own index. removeUnusedJandexIndex can go too, once vaadin-jandex/vaadin-core-jandex stop re-indexing JARs that carry an index. Until then, expect split-package log noise for Flow classes that end up in both the per-module and the aggregate index.

@mcollovati

Copy link
Copy Markdown
Collaborator

To be merged after vaadin/platform#9518

@totally-not-ai

Copy link
Copy Markdown
Contributor Author

@mcollovati Noted, no change needed here. Once vaadin/platform#9518 lands, the aggregate indexes skip the jars that now carry their own index, so merging this afterwards avoids indexing Flow classes twice in the meantime.

@mcollovati
mcollovati added this pull request to the merge queue Sep 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 25, 2026
@mcollovati
mcollovati added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit a54d559 Sep 25, 2026
44 checks passed
@mcollovati
mcollovati deleted the chore/per-module-jandex-indexes branch September 25, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants