Maven Embedded Jetty automatic redeploy

How to automatically redeploy embedded Jetty if you change some Java class?

If you run embedded Jetty using goal jetty:run, you will notice that when you change some Java class (for example a Servlet), the application won't automatically redeploy, so you will have to stop the whole server and run it again.

 

To change that go to pom.xml and add this configuration to the Jetty plugin:

 

<configuration>
  <scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>

 

 

Also if you use STS (Spring Tool Suite), in latest versions you have this Relaunch button, which will restart the server.