To do web development, testing is a very time-consuming thing. So we should test it in a simpler and quicker way. Let's introduce a lightweight container--jetty today. J today said Etty is a maven plug-in Jetty-maven-plugin, with Maven to use very convenient, its configuration is very simple, below we see how it works!
Under the <project> tab of the Pom.xml file, add the following code for example:
<build><plugins><plugin><groupId>org.mortbay.jetty</groupId><artifactId> jetty-maven-plugin</artifactid><version>8.1.10.v20130312</version><configuration>< Connectors><connector implementation= "Org.eclipse.jetty.server.nio.SelectChannelConnector" ><port >8888</port></connector></connectors><webappsourcedirectory>${basedir}/webcontent </webAppSourceDirectory><scanIntervalSeconds>10</scanIntervalSeconds><webAppConfig> <contextpath>/${project.artifactid}</contextpath></webappconfig></configuration></ Plugin></plugins></build>
so the configuration is complete, then right-click on the Pom.xml file, point to Run as, select Maven build, enter "Jetty:run" in the "goals" of the pop-up form, and then click "Run".
when it appears for example the following information represents jetty startup success:
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of ten seconds.
OK, how about that? Very easy, let's try it!
Rookie learn Java (19)--web Project Test Good helper, Maven+jetty