mvn jetty:run 启动很慢解决办法

jetty8,使用jetty:run时启动相当慢,原因是:
The Jetty8 have to scan all the jar files to search those "Servlet3" features (web-fragment / annotations ... etc )
solution 1:add the following code to web.xml:
metadata-complete="true"

if it doesnt work,go to solution 2:
step 1:create a file called jetty-contexts.xml, and put it under the src/test/java/
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
	<Call name="setAttribute">
		<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
		<Arg>.*/.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$
		</Arg>
	</Call>
</Configure>


step 2: modify your pom.xml config:
<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>8.1.12.v20130726</version>
				<configuration>
					<contextXml>src/test/java/jetty-contexts.xml</contextXml>
					<webAppConfig>
						<defaultsDescriptor>src/test/java/webdefault.xml</defaultsDescriptor>
						<contextPath>/solr</contextPath>
					</webAppConfig>
				</configuration>
			</plugin>


now your jetty:run should run like hell!

猜你喜欢

转载自chembo.iteye.com/blog/1934890
mvn