Run Web project configuration under Eclipse with Maven's jetty plugin

Source: Internet
Author: User

Citation source

JETTY7/8 Maven Plugin configuration: Http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin

Jetty9 Latest Maven Plugin configuration: http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html or the latest release version

Jetty limitations for each version: Http://wiki.eclipse.org/Jetty/Starting/Jetty_Version_Comparison_Table

Jetty 7 must be JDK 1.5+,servlet 2.5, similar to Tomcat 6, the latest release version:

<plugin> <groupId>org.mortbay.jetty</groupId> <artifactid>jetty-maven-plugin</ Artifactid> <version>7.6.16.v20140903</version></plugin>

Jetty 8 must be JDK 1.6+,servlet 3.0, similar to Tomcat 7, the latest release version:

<plugin> <groupId>org.mortbay.jetty</groupId> <artifactid>jetty-maven-plugin</ Artifactid> <version>8.1.16.v20140903</version></plugin>

Jetty 9 must be JDK 1.7+,servlet 3.0+, similar to Tomcat 8, the latest release version:

<plugin> <groupId>org.eclipse.jetty</groupId> <artifactid>jetty-maven-plugin</ Artifactid> <version>9.2.10.v20150310</version></plugin>

Many domestic applications may upgrade the JDK version, but often still use Servlet2.5 for development, so this article uses Jetty 8 as a case.


Step One

Add the following configuration to the Pom.xml of the project:

<project>  ....  <build>    ....       <plugins>        <plugin>            <groupId>org.mortbay.jetty</groupId>            <artifactId>jetty-maven-plugin</artifactId>            <version>8.1.16.v20140903</version >           <configuration>                <scanintervalseconds>5</ scanintervalseconds>                <webApp>                    <contextpath>/test</contextpath>                </webApp>             </configuration>         </plugin>       </plugins>    ....  </build>   </project>

Step Two

Run using Eclipse's MAVEN build, goals configuration,


jetty:run-djetty.port=9080

The green part is because my application's Log4j.xml uses the ${sys:catalina.base} This tomcat environment variable, when starts Jetty the log4j will error, in order to solve this problem, I specially added this Catalina.base is configured and specified to a specific path. Another problem is that this configuration is not valid in environment and must be configured in Parameter for unknown reasons.

Once the above scenario has been configured, MAVEN will automatically download the plugin dependencies, compile and run the Web app for the first time, and happily access your app through the browser after successful completion.


Run Web project configuration under Eclipse with Maven's jetty plugin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.