Maven – Run Webapp by maven-jetty-plugin

I always think that building a good developing environment for developers are essential in terms of efficiency as well as quality. maven-jetty-plugin let you run the webapp without deploying the .war to Java web container and run debug mode directly in the Eclipse IDE.

I will shows you how to add and run the maven-jetty-plugin in the spring-mvc-trail project we built in


1. Add the maven-jetty-plugin in the pom.xml base on the above spring-mvc-trail project

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
	<name>Spring MVC Trial</name>
	<description>Spring MVC Trial</description>
	<!-- Project properties -->
	<!-- Build Configuration -->
						<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
					<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
	<!-- Dependencies -->
		<!-- Spring framework -->
		<!-- Other dependencies -->


2. Run mvn clean install

3. Create a new maven build in Eclipse Run Configuration as follow OR run mvn jetty:run at your project directory which contains the pom.xml in the shell prompt


4. Open the http://localhost:9090/spring-mvc-trial/hello.htm in browser


5. The log written in the to stdout should be printed in the console

[INFO] Started Jetty Server
2010-03-01 22:39:56.922::INFO:  Started SelectChannelConnector@
2010/3/1 下午 10:42:18 springapp.web.HelloController handleRequest
資訊: Returning hello view
stdout - Returning hello view


6. You can also find the requests log at /target as configured in the pom.xml

Done =)

Reference: Maven Jetty Plugin Configuration Guide

11 thoughts on “Maven – Run Webapp by maven-jetty-plugin”

  1. Thank so much for these explanations. It was so helpful for me !
    Could you please tell me how can I change Jetty port (9090)

    thanks in advance


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s