This page covers the patternfly-java-gwt Maven module: its structure, the org.patternfly.PatternFly GWT module descriptor, the PatternFly entry point class, and how Popper.js is injected at runtime. It also explains how a consumer GWT application wires up the module.
For the equivalent J2CL setup, see J2CL Integration. For a comparison of the two targets, see GWT vs J2CL.
patternfly-java-gwt is the platform-specific Maven artifact that GWT applications depend on. It collects the full PatternFly Java component and layout modules under a single GWT module descriptor and adds the GWT-specific Popper.js injection mechanism.
| Property | Value |
|---|---|
Maven artifactId | patternfly-java-gwt |
Maven packaging | gwt-lib |
| GWT module name | org.patternfly.PatternFly |
| GWT plugin version property | version.gwt.plugin (1.2.0) |
| GWT SDK version property | version.gwt (2.13.0) |
Sources: gwt/pom.xml1-83
The module pulls in the two main content modules plus the GWT SDK:
Dependency diagram: patternfly-java-gwt compile graph
Sources: gwt/pom.xml47-70
The sources classifier variants are required because GWT compiles Java source, not bytecode. They ensure the GWT compiler can find the Java source files for transitive dependencies.
The gwt-maven-plugin registers the module descriptor under the name org.patternfly.PatternFly gwt/pom.xml74-80 By GWT convention, this descriptor resolves to a .gwt.xml file on the Java source path at the package location matching the module name.
Inheritance: consumer .gwt.xml to PatternFly module
A consumer application inherits the module with a single line in its own .gwt.xml:
Sources: README.md75-81 gwt/pom.xml73-81
PatternFly Entry Point ClassPatternFly in gwt/src/main/java/org/patternfly/PatternFly.java21-40 is the GWT EntryPoint for the module. Its sole job is to inject a bundled, self-contained copy of Popper.js into the page when the GWT module initialises.
Entry point execution flow
Sources: gwt/src/main/java/org/patternfly/PatternFly.java36-39
PatternFly components that use positioned overlays (tooltips, popovers, dropdowns) depend on Popper.js. For J2CL, the Popper.js file is included as a plain JavaScript resource. For GWT, including external <script> tags is impractical inside a GWT module, so the GWT module takes a different approach: the entire minified Popper.js v2.11.8 source is stored as the Java string constant POPPER_JS gwt/src/main/java/org/patternfly/PatternFly.java25-34
The string is almost identical to the published CDN build (@popperjs/[email protected]/dist/umd/popper.min.js), but with one addition appended inside the IIFE before it closes:
;$wnd.Popper={createPopper:we};
This GWT-specific line exports the createPopper function onto $wnd (GWT's alias for window) so that the rest of the PatternFly Java code can find it by its expected global name.
At runtime, onModuleLoad() calls ScriptInjector.fromString(POPPER_JS).inject(), which evaluates the string as JavaScript in the page's context, making window.Popper.createPopper available immediately after module load.
Popper.js injection mechanism: class and call chain
Sources: gwt/src/main/java/org/patternfly/PatternFly.java21-40
| Item | Detail |
|---|---|
| Popper version bundled | @popperjs/core v2.11.8 |
| Injection mechanism | com.google.gwt.core.client.ScriptInjector |
| Global symbol exposed | window.Popper.createPopper |
| GWT export code appended | ;$wnd.Popper={createPopper:we}; |
The steps a GWT application must follow to use patternfly-java-gwt:
Import the BOM to manage versions:
Add the gwt-lib dependency:
Inherit the GWT module in the application's .gwt.xml:
No additional JavaScript setup is required. The PatternFly entry point automatically injects Popper.js when the GWT module loads.
Note: PatternFly Java does not bundle PatternFly CSS stylesheets. The application is responsible for including the PatternFly CSS, either via a
<link>tag or a bundler.
Sources: README.md40-88 gwt/pom.xml1-83 bom/pom.xml151-161
The patternfly-java-gwt module is a leaf node in the Maven dependency graph — nothing else in the project depends on it. It exists solely as the integration artifact for GWT consumers and mirrors the role that patternfly-java-j2cl plays for J2CL consumers.
Sources: gwt/pom.xml47-70 j2cl/pom.xml35-44