Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review Jetty Maven Plugin scanning defaults #6020

Closed
sbordet opened this issue Mar 2, 2021 · 4 comments · Fixed by #6023
Closed

Review Jetty Maven Plugin scanning defaults #6020

sbordet opened this issue Mar 2, 2021 · 4 comments · Fixed by #6023
Assignees

Comments

@sbordet
Copy link
Contributor

@sbordet sbordet commented Mar 2, 2021

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)
@sbordet
Copy link
Contributor Author

@sbordet sbordet commented 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 ConsoleReader to check for the string "redeploy", rather than just a newline.

janbartel added a commit that referenced this issue Mar 2, 2021
Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel
Copy link
Contributor

@janbartel janbartel commented 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
Copy link
Contributor Author

@sbordet sbordet commented 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
Copy link
Contributor

@janbartel janbartel commented 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?

janbartel added a commit that referenced this issue Mar 9, 2021
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Mar 9, 2021
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Mar 9, 2021
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Mar 9, 2021
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Mar 10, 2021
* Issue #6020 Fix redeploy error jetty-maven-plugin

Signed-off-by: Jan Bartel <janb@webtide.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants