我在Windows上使用Java 1.8.0_144,Eclipse(Oxygen)和RunJettyRun插件来测试我的Web应用程序.当我以非静态方法修改Java代码(不更改方法签名或添加新方法)时,除非我关闭并重新启动RunJettyRun,否则不会反映更改.我做了一些如下所示的配置,但它没有工作.
如何在不关闭RunJettyRun的情况下看到代码更改有效?
我正在使用没有任何web.xml的Servlet 3.0只使用Spring WebApplicationInitializer.当我在eclipse中使用Run-Jetty-Run启动Web应用程序时,JARScanning大约需要40秒,因为它试图在所有jar中找到HandlesTypes注释.
因此,我尝试在jetty-web.xml中设置WebInfIncludeJarPattern(我也尝试了jetty-context.xml)并将其放在webapp/WEB-INF文件夹中,如http://wiki.eclipse.org/Jetty中所述/ Howto/Avoid_slow_deployment.我还设置了metadata-complete ="true".jetty-web.xml文件的内容是:
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
<Arg>.*/.*foo-api-[^/]\.jar$|./.*bar-[^/]\.jar$|./.*wibble[^/]*\.jar$</Arg>
</Call>
</Configure>
Run Code Online (Sandbox Code Playgroud)
但是,JarScanner仍会扫描所有JAR文件.在调试输出中我可以看到,在完成所有JARScanning之后解析了jetty-web.xml文件:
OUTPUT:
2013-08-30 09:09:52.836:DBUG:oejw.WebAppContext:preConfigure o.e.j.w.WebAppContext{/admin2,[file:/C:/....../src/main/webapp/]} with runjettyrun.webapp.RJRWebInfConfiguration@1cdc4a5
......
2013-08-30 09:09:52.979:DBUG:oejw.WebAppContext:preConfigure o.e.j.w.WebAppContext{/admin2,[file:/C:/..../src/main/webapp/]} with org.eclipse.jetty.webapp.WebXmlConfiguration@136f39e
2013-08-30 09:09:53.076:DBUG:oejw.WebDescriptor:file:/C:/......../src/main/webapp/WEB-INF/web.xml: Calculated metadatacomplete = True with version=3.0
2013-08-30 09:09:53.076:DBUG:oejw.WebAppContext:preConfigure o.e.j.w.WebAppContext{/admin2,[file:/C:/....../src/main/webapp/]} with runjettyrun.webapp.RJRMetaInfoConfiguration@164de63
... <LOTS OF JARSCANNING>
2013-08-30 09:10:36.677:DBUG:oejw.JarScanner:Search of file:/C:/......./httpclient-cache-4.1.2.jar
2013-08-30 09:10:36.710:DBUG:oejw.WebAppContext:configure o.e.j.w.WebAppContext{/.................} with org.eclipse.jetty.webapp.JettyWebXmlConfiguration@803365
2013-08-30 09:10:36.711:DBUG:oejw.JettyWebXmlConfiguration:Configuring web-jetty.xml
2013-08-30 09:10:36.715:DBUG:oejw.JettyWebXmlConfiguration:Configure: file:/C:/......./src/main/webapp/WEB-INF/jetty-web.xml
Run Code Online (Sandbox Code Playgroud)
如何强制RJR提前获取jetty-web.xml并仅扫描其中指定的文件?或者在RJR中还有其他方法来指定要扫描的JARS吗?
我使用以下版本:Eclipse:Kepler Release 4.3 Build id:20130614-0229 RJR:1.3.3.201301020723 Jetty:8.1.8.v20121106
WINDOWS:64位
谢谢