Skip to content

feat: consume bootstrap via struts webjars (5.3.8 + icons 1.13.1) - #423

Merged
lukaszlenart merged 9 commits into
release/6.0.xfrom
docs/webjars-support-design
Aug 25, 2026
Merged

feat: consume bootstrap via struts webjars (5.3.8 + icons 1.13.1)#423
lukaszlenart merged 9 commits into
release/6.0.xfrom
docs/webjars-support-design

Conversation

@lukaszlenart

@lukaszlenart lukaszlenart commented Jul 6, 2026

Copy link
Copy Markdown
Member

What

Replaces the plugin's ~2000 manually-vendored Bootstrap and bootstrap-icons files with org.webjars dependencies, served via Struts core's WebJars support (<@s.webjar> / apache/struts WW-5640, PR apache/struts#1765).

  • Bootstrap 5.3.5 → 5.3.8, bootstrap-icons 1.11.3 → 1.13.1, now sourced from org.webjars:bootstrap + org.webjars.npm:bootstrap-icons.
  • head.ftl resolves asset URLs through <@s.webjar path="…" var="…"/> and composes them into <@s.script>/<@s.link> via OGNL %{#var}.
  • Deletes the vendored template/bootstrap/css/**, template/bootstrap/bootstrap-icons/**, and template/bootstrap/js/bootstrap*. Keeps the plugin's own validation.js/validation.min.js.
  • Plugin artifact shrinks from ~3.5 MB → 47 KB. Future Bootstrap bumps become a one-line dependency change (Renovate-friendly).

Why

Every Bootstrap release previously required re-downloading and re-committing ~2000 files by hand. WebJars turn that into a dependency bump.

Ready to merge

An earlier revision of this PR was blocked on an unreleased Struts (7.2.2-SNAPSHOT) and carried a temporary Apache snapshots repository. That blocker is gone:

  • release/6.0.x now builds against Struts 7.3.0 (Update struts2.version to v7.3.0 #425), which ships the WebJars support (WebJar, WebJarModel, StrutsWebJarUrlProvider).
  • The branch has been rebased onto release/6.0.x, and the temporary apache-snapshots <repositories> block has been removed — everything resolves from Maven Central.

The README compatibility row keeps version >= 7.2.2 as the declared floor, since 7.2.2 is the first release containing WebJars support.

Verification

Full reactor mvn clean install (JDK 17) is green after the rebase, and resolves:

org.apache.struts:struts2-core:jar:7.3.0
org.webjars:bootstrap:jar:5.3.8
org.webjars.npm:bootstrap-icons:jar:1.13.1
org.webjars:webjars-locator-lite:jar:1.1.4

Runtime behaviour was verified end-to-end via the showcase (mvn -pl struts2-bootstrap-showcase jetty:run):

  • …/static/webjars/bootstrap/5.3.8/css/bootstrap.min.css200 text/css
  • …/static/webjars/bootstrap/5.3.8/js/bootstrap.bundle.min.js200 text/javascript
  • …/static/webjars/bootstrap-icons/1.13.1/font/bootstrap-icons.min.css200 text/css
  • …/static/webjars/bootstrap-icons/1.13.1/font/fonts/bootstrap-icons.woff2200 font/woff2 (confirms the icons CSS relative ./fonts/ path resolves)
  • validation.min.js still served from the plugin static path → 200
  • No FreeMarker errors.

Notes

  • Release version in the README/compat table is set to 6.1.1 (matches current pom.xml); adjust if a different version is intended.
  • Design & plan under docs/superpowers/. Those documents are historical records of the design work and still refer to 7.2.2/7.2.2-SNAPSHOT as the target at the time.

Closes #363

🤖 Generated with Claude Code

lukaszlenart and others added 9 commits August 25, 2026 11:20
…umer)

Requirements/design spec for adding first-class WebJars support to Struts
core, served through the static-content pipeline with version-less path
resolution, and consuming it from the struts2-bootstrap plugin to replace
the ~2000 manually-vendored Bootstrap/bootstrap-icons files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Self-contained, repo-portable framework-only spec to start WebJars support
work fresh in apache/struts. Plugin-side consumer work continues here once
the framework support ships.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Framework support merged (apache/struts PR #1765, WW-5640, in 7.2.2-SNAPSHOT).
Plan covers pom deps + struts 7.2.2 floor, head.ftl -> <@s.webjar>, removal of
vendored bootstrap/bootstrap-icons, README, and showcase verification. Coding
deferred until Struts 7.2.2 is released.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Build against 7.2.2-SNAPSHOT (Apache snapshots repo) until 7.2.2 is released.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The <#assign>..</#assign> capture of <@s.webjar> yields a FreeMarker
markup_output, which ?trim rejects. Use the tag's var attribute (stored in
the value-stack context) and reference it through OGNL %{#var} in
<@s.script>/<@s.link> src/href (both OGNL-evaluated via findString).
Verified end-to-end in the showcase: bootstrap css/js, icons css and woff2
all serve 200.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lukaszlenart
lukaszlenart force-pushed the docs/webjars-support-design branch from e18d3f1 to 5fe0911 Compare August 25, 2026 09:22
@lukaszlenart
lukaszlenart merged commit b7996c3 into release/6.0.x Aug 25, 2026
1 check passed
@lukaszlenart
lukaszlenart deleted the docs/webjars-support-design branch August 25, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant