title | order | layout |
---|---|---|
Automatic Restart with Jetty Maven Plugin |
5 |
page |
The Jetty Maven plugin
with the scanIntervalSeconds
configuration set to a positive value performs complete application restart
when the given number of seconds have elapsed since the last Java change. For instance:
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.27.v20200227</version>
<configuration>
<scanIntervalSeconds>2</scanIntervalSeconds>
</configuration>
</plugin>
<!-- more plugins -->
</plugins>
Note
|
We recommend using Jetty Maven Plugin 9.4.27.v20200227 or higher.
There is a known issue in the previous versions that causes RouteNotFoundException when trying to reload
Java changes automatically.
|
Since the plugin performs a full server restart, all Java changes are picked up.
In addition, it is possible to add a new PolymerTemplate
class to an existing JS template module or add
a new JS module (see Creating A Simple Component Using the Template API).
Other working scenarios are:
-
adding a new CSS import (as a frontend resource and use it in Java via
@CssImport
annotation) -
adding a new frontend JS module file (and use it with a Java class)
-
modifying the existing frontend resource (JS module or imported CSS file)
In the latter case webpack dev server cares about changes made in the JS module only.
Note that the session is not preserved during the restart.