Hi,

I would like to hear your opinion about a small development tool I have
been working on.

The problem
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 an
edit in src/main/resources is not picked up until you restart Jetty. I
checked it with the showcase: the framework's reload works fine as soon as
the copy in target/classes changes - the gap is in the build layout, not in
Struts. On top of that, Jetty's own scanner restarts the whole webapp when
target/classes changes.

The idea
A new Maven plugin, struts-maven-plugin, with a single goal, struts:watch,
which runs next to whatever server you already use (jetty:run, Cargo, an
IDE server). It polls the module's resource directories and pushes each
changed file into target/classes using the project's own
maven-resources-plugin settings (filtering included), so Struts' existing
reload picks it up on the next request. You can run it in a second terminal
(mvn struts:watch) or bind it to process-resources and switch it on with
mvn jetty:run -Dstruts.watch. It also warns at startup when devMode or the
reload switches are off, as an explicit false wins over devMode.

Combined with a small Jetty setting (scan only **/*.class) you get
save-and-refresh for struts.xml and properties, with no restart.

What it does not do: Java class reloading (use a restart or debugger
hotswap), JSP/FTL in src/main/webapp (already served from source),
multi-module applications, Gradle or Struts Boot.

Status
- Jira: https://issues.apache.org/jira/browse/WW-5864
- PR (draft): https://github.com/apache/struts/pull/2143
- it lives in a new tools/ module in the main repo, is released together
with Struts and marked [EXPERIMENTAL], the same way as Struts Boot, so
goals and parameters may still change

Questions
1. Is the struts: goal prefix (artifactId struts-maven-plugin) fine for you?
2. Would you use it, and which servers or setups should I check besides
Jetty?

Any feedback is welcome.

Regards
Lukasz

Reply via email to