Maven的环境下,修改pom.xml中加入插件后就能用jetty:run启动
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.1.v20120215</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <stopKey>stop</stopKey> <stopPort>9999</stopPort> <webAppConfig> <contextPath>/${project.build.finalName}</contextPath> </webAppConfig> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>8888</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> </configuration> </plugin>
修改js时无法保存,提示"请求的操作无法在使用用户映射区域打开的文件上执行"解决方法:
找到本地maven库repository\org\eclipse\jetty\jetty-webapp\8.1.1.v20120215\jetty-webapp-8.1.1.v20120215.jar,修改org\eclipse\jetty\jetty-webapp目录中webdefault.xml文件中useFileMappedBuffer的值为false
<init-param> <param-name>useFileMappedBuffer</param-name> <param-value>false</param-value> </init-param>