Repository navigation
Review Jetty Maven Plugin scanning defaults #6020
Copy link
Copy link
Closed
Description
Jetty version
10.0.x
Description
By default, the Jetty Maven Plugin has scan=0 which means when running jetty:run on a terminal, the following is printed:
Hit <enter> to redeploy:
However, this default is confusing because hitting <enter> on the terminal is useful to separate start-up log lines from application log lines, or application log lines between different requests.
Setting scan=5 disables the above "hit enter" but prints:
[INFO] Scan interval ms = 5
The time unit is wrong, should be seconds.
Then, modifying web.xml and waiting for the re-scan, the following is printed:
[INFO] Restarting o.e.j.m.p.MavenWebAppContext@2c54c497{CometD Test WebApp,/,[file:///home/simon/opensource/cometd/cometd6/cometd-demo/src/main/webapp/, file:///home/simon/opensource/cometd/cometd6/cometd-demo/target/jetty_overlays/cometd-javascript-dojo-6_0_2-SNAPSHOT_war/, file:///home/simon/opensource/cometd/cometd6/cometd-demo/target/jetty_overlays/cometd-javascript-jquery-6_0_2-SNAPSHOT_war/, file:///home/simon/opensource/cometd/cometd6/cometd-demo/target/jetty_overlays/cometd-javascript-angular-6_0_2-SNAPSHOT_war/, file:///home/simon/opensource/cometd/cometd6/cometd-demo/target/jetty_overlays/cometd-javascript-examples-dojo-6_0_2-SNAPSHOT_war/, file:///home/simon/opensource/cometd/cometd6/cometd-demo/target/jetty_overlays/cometd-javascript-examples-jquery-6_0_2-SNAPSHOT_war/, file:///home/simon/opensource/cometd/cometd6/cometd-demo/target/jetty_overlays/cometd-javascript-examples-angular-6_0_2-SNAPSHOT_war/, file:///home/simon/opensource/cometd/cometd6/cometd-demo/target/jetty_overlays/cometd-javascript-examples-vanilla-6_0_2-SNAPSHOT_war/],AVAILABLE}{file:///home/simon/opensource/cometd/cometd6/cometd-demo/src/main/webapp/}
[INFO] Classes = /home/simon/opensource/cometd/cometd6/cometd-demo/target/classes
[ERROR] Error reconfiguring/restarting webapp after change in watched files
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep (Native Method)
at org.eclipse.jetty.maven.plugin.MavenWebAppContext.doStop (MavenWebAppContext.java:340)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop (AbstractLifeCycle.java:132)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.restartWebApp (JettyRunMojo.java:339)
at org.eclipse.jetty.maven.plugin.JettyRunMojo$2.filesChanged (JettyRunMojo.java:194)
at org.eclipse.jetty.util.Scanner.reportBulkChanges (Scanner.java:824)
at org.eclipse.jetty.util.Scanner.reportDifferences (Scanner.java:735)
at org.eclipse.jetty.util.Scanner.scan (Scanner.java:628)
at org.eclipse.jetty.util.Scanner$ScanTask.run (Scanner.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run (ScheduledThreadPoolExecutor.java:304)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1130)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:630)
at java.lang.Thread.run (Thread.java:831)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
sbordet commentedon Mar 2, 2021
I would prefer
<enter>to actually add newlines to the terminal, rather than being a command.Perhaps we can change the behavior so that if a user types "redeploy" then the webapp is redeployed -- it should be an easy change in
ConsoleReaderto check for the string "redeploy", rather than just a newline.Issue #6020 Fix redeploy error jetty-maven-plugin
janbartel commentedon Mar 2, 2021
@sbordet use of the "Enter" key to indicate a manual redeployment has been there since jetty-7 days, so I don't see that it could be changed in jetty-10 or indeed jetty-11, it would have to wait until jetty-12.
For the other 2 points, I've raised PR #6023
sbordet commentedon Mar 3, 2021
@janbartel the default for the "enter" key was off for 9.4.x. It has been changed to on for 10. I think off is a better default. Keep the functionality, just change the default.
janbartel commentedon Mar 3, 2021
@sbordet let's forget about which key it is for the moment, let's just consider the functionality. There are two modes for the jetty:run goal: 1. automatic redeploy 2. manual redeploy. Is it worthwhile having another mode 3. never redeploy (which would be the default). Mode 3. is satisfied by mode 2. by simply not pressing whatever key causes the redeploy, so I think mode 3. is logically redundant.
The other thing to consider is that jetty-10 has already been released, so changing the behaviour at this point might be considered a breaking change?
Now, I understand you want to be able to press 'return' to make some blank lines on the output - if you hold down the 'space' key, you'll get the blank lines without a redeploy.
WDYT?
Issue #6020 Use ScheduledExecutorScheduler for Scanner
Issue #6020 Fix multiple restart after change to pom.xml
Issue #6020 update doco
Issue #6020 move location of :experimental: attribute
Issue #6020 Fix redeploy error jetty-maven-plugin (#6023)