[Java] Use jetty with Maven to check the operation.

less than 1 minute read


When using eclipse to check the operation of a dynamic file, it only works on that terminal. So, check the operation using jetty. And personally, the directory structure of the maven project in eclipse is different and it is troublesome.


edit pom.xml

Add the following plugins.

              <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">

Run jetty.

Execute the following from the command line.

mvn jetty:run

Connect to localhost.

Access http://localhost:8080.


Sometimes jetty didn’t work. It took time to determine whether pom.xml was bad, the terminal was bad, or the plugin was bad. As a result, it is better to set up a container for the build and check it each time, and there is no dependency problem, so I think it is good.