This file provides guidance to agents when working with code in this repository.
Hawtio v5 custom console sample using @hawtio/react. Demonstrates how to package a custom console WAR that includes selected built-in plugins (JMX, Camel, etc.) plus custom TypeScript plugins. Built with Java/Maven (backend) and React/Webpack Module Federation (frontend).
- Maven builds BOTH Java WAR and TypeScript plugin via
frontend-maven-plugin - Frontend build happens during Maven lifecycle (not separate step)
- Skip frontend rebuild with
-Dskip.yarnflag (saves time after first build) - WAR final name is
sample-plugin(nothawtio-sample-custom-console) - Plugin TypeScript code lives in
sample-plugin/subdirectory (notsrc/)
- Dev mode requires TWO servers:
mvn jetty:run -Dskip.yarn(backend) +cd sample-plugin && yarn start(frontend) - Frontend dev server runs on port 3001, backend on 8080
- Access dev console at http://localhost:3001/hawtio/ (NOT 8080)
- Connect plugin requires Jolokia endpoint: http://localhost:8080/hawtio/jolokia
- Branding URLs in dev mode are rewritten:
/sample-plugin/*→/hawtio/*(see webpack.config.cjs line 138)
- Container name
samplePluginin webpack MUST matchscope()in PluginContextListener.java - Exposed module
./pluginMUST matchmodule()in PluginContextListener.java - Plugin entry function name is
pluginby default (can override withpluginEntry()) - React, react-dom, react-router-dom, @hawtio/react MUST be singletons in shared config
- Version placeholder
__PACKAGE_VERSION_PLACEHOLDER__replaced byreplace-versionscript post-build
- Plugins register via
hawtio.addPlugin()not standard React Router isActivefunction controls plugin visibility (can check JMX tree withworkspace.treeContainsDomainAndProperties())- Help and preferences registered separately via
helpRegistry.add()andpreferencesRegistry.add() - Plugin branding configured via
configManager.configure()in index.ts (not config file)
- Prettier: 120 char width, no semicolons, single quotes (including JSX)
- TypeScript: strict mode, noUncheckedIndexedAccess, noImplicitReturns enabled
- Indentation: 2 spaces (JS/TS), 4 spaces (Java)
- Module resolution: "bundler" (not "node")
- Jest configured but tests pass with no tests (
--passWithNoTests) - No test files currently exist in codebase
- DO NOT read nor modify
.env*files without explicit permission - DO NOT perform
gitcommands without explicit permission - DO NOT modify files outside
sample-plugin/directory without explicit permission - DO NOT change Module Federation config (container name, exposed modules) without updating both webpack.config.cjs AND PluginContextListener.java
- DO NOT modify Maven build lifecycle or frontend-maven-plugin configuration
- DO NOT change port numbers (3001 for dev frontend, 8080 for backend) as they're hardcoded in multiple places
- DO NOT add dependencies without checking Module Federation shared config compatibility