[
https://issues.apache.org/jira/browse/WW-5864?focusedWorklogId=1054729&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1054729
]
ASF GitHub Bot logged work on WW-5864:
--------------------------------------
Author: ASF GitHub Bot
Created on: 14/Nov/26 08:55
Start Date: 14/Nov/26 08:55
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #2143:
URL: https://github.com/apache/struts/pull/2143
Fixes [WW-5864](https://issues.apache.org/jira/browse/WW-5864)
## Why
With `struts.devMode=true`, Struts reloads `struts.xml` and message bundles
when the files it loaded change. Under `mvn jetty:run` those files are the
copies in `target/classes`, and nothing updates them while the server runs, so
edits in `src/main/resources` need a restart. A spike confirmed the framework's
reload works as soon as the `target/classes` copy changes; the gap is the build
layout. Jetty's `<scan>` additionally restarted the whole webapp on top of
Struts' own reload.
## What
A new `tools/struts-maven-plugin` module (first `maven-plugin` packaging in
the reactor) with a `watch` goal that runs alongside the developer's server:
- polls the module's `<resources>` directories (500 ms; the JDK
`WatchService` polls slowly on macOS) and debounces, so an editor's
save-via-rename gives one push
- pushes each changed file into `target/classes` through `maven-filtering`,
using the effective `maven-resources-plugin` configuration (delimiters,
encodings, `escapeString`, `nonFilteredFileExtensions`, plugin-level
`<filters>`/`useBuildFilters`, …); deletes are mirrored; files whose output is
missing or older are pushed once at startup
- blocking mode (`mvn struts:watch`) or a background mode bound to
`process-resources`, which does nothing unless `-Dstruts.watch` (`mvn jetty:run
-Dstruts.watch`); one background watcher per output directory
- warns at startup, best-effort, when `struts.devMode` or the reload
switches are off (an explicit `false` wins over devMode, as in
`StrutsBeanSelectionProvider#switchDevMode`)
- single module only: run from a reactor with more than one project it fails
and asks for `-pl <module>`
Out of scope: Java class reloading, webapp files, multi-module apps, Gradle,
Struts Boot.
The showcase declares the plugin (inert by default) and its Jetty config
scans only `**/*.class`, so recompiles still restart the webapp but resource
pushes don't. The showcase keeps `devMode=false` because it also runs the ITs;
the README explains what an app needs.
Design and plan:
`docs/superpowers/specs/2026-11-14-struts-maven-plugin-watch-design.md`,
`docs/superpowers/plans/2026-11-14-struts-maven-plugin-watch.md`.
## Testing
- 49 unit tests (JUnit 4 + AssertJ)
- one invoker IT runs the real goal on a fixture project; the edit is gated
on the `Watching N resource root(s)` log line and the push must be logged after
it, so the startup push cannot satisfy it. It uses blocking mode with a
timeout, since a background run's Maven JVM exits immediately
- live check: `mvn jetty:run -Dstruts.watch` on the showcase (devMode
switched on locally) — a new action and a changed message were picked up on the
next request, no Jetty restart
## Build cost
The IT adds ~12 s to `verify`/`install` of this module and is skipped with
`-DskipITs`. `src/it/settings.xml` uses the invoker docs' local-repository
profile (`@localRepositoryUrl@`), so the IT resolves from the outer local repo;
an artifact missing there can still fall back to Central rather than failing.
## Known follow-ups (not in this PR)
- `fileNameFiltering=true` with `${...}` in a file name: the output path is
computed from the unfiltered name
- the background thread lives as long as the JVM — under mvnd a later build
reuses the earlier watcher
- the `<outputDirectory>` warning also fires when it is set to the default
value
Security review (`/security-review` plus `SECURITY.md`/`THREAT_MODEL.md`):
no findings — build-time tool, inputs are the developer's own pom and resources.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1054729)
Remaining Estimate: 0h
Time Spent: 10m
> struts:watch Maven goal to push resource changes into target/classes during
> development
> ---------------------------------------------------------------------------------------
>
> Key: WW-5864
> URL: https://issues.apache.org/jira/browse/WW-5864
> Project: Struts 2
> Issue Type: New Feature
> Components: Build Management
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.6.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> With {{struts.devMode=true}}, Struts reloads {{struts.xml}} and message
> bundles when the files it loaded change. Under {{mvn jetty:run}} those files
> are the copies in {{target/classes}}, and nothing updates them while the
> server runs. Edits in {{src/main/resources}} therefore need a full server
> restart, even though the framework's reload mechanism works.
> Add a {{struts-maven-plugin}} with a {{watch}} goal that runs alongside the
> developer's server. It watches the module's resource directories and pushes
> each changed file into the output directory, using the project's own
> {{maven-resources-plugin}} filtering settings, so Struts' existing reload
> picks it up on the next request.
> * Blocking mode ({{mvn struts:watch}}), plus a background mode bound to
> {{process-resources}} that does nothing unless {{-Dstruts.watch}} is passed
> ({{mvn jetty:run -Dstruts.watch}}).
> * Polling-based change detection (the JDK {{WatchService}} polls slowly on
> macOS); deletes are mirrored.
> * Warns at startup when devMode or the reload switches are explicitly off.
> * Single module only. Run from a multi-module reactor, it fails fast and asks
> for {{-pl <module>}}.
> * Out of scope: Java class reloading, webapp files, multi-module, Gradle,
> Struts Boot.
> Design:
> {{docs/superpowers/specs/2026-11-14-struts-maven-plugin-watch-design.md}}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)