Building a Java Web project with Eclipse + Maven (iii)

Source: Internet
Author: User
Tags java web

Using the jetty Maven plugin and the Tomcat maven plugin

1. Jetty Maven Plugin

The POM configuration is as follows

<Build>    <Finalname>WebApp</Finalname>    <Plugins>        <plugin>            <groupId>Org.eclipse.jetty</groupId>            <Artifactid>Jetty-maven-plugin</Artifactid>            <version>9.4.6.v20170531</version>        </plugin>    </Plugins></Build>

Add Jetty:rum command at run time

Run,console prompts jetty to start successfully.

At this point, access to the Site Web project is localhost:8080 through the browser

2. Tomcat Maven Plugin

The POM is configured as follows and can be found from the Tomcat official documentation.

<Build>    <Finalname>WebApp</Finalname>    <Plugins>        <plugin>            <groupId>Org.apache.tomcat.maven</groupId>            <Artifactid>Tomcat7-maven-plugin</Artifactid>            <version>2.2</version>        </plugin>    </Plugins></Build>

Run as follows, add the Tomcat:run command

Run Success prompt

3, the implementation of the project packaging directly run plug-ins can be added to the following POM configuration

<Build>    <Finalname>WebApp</Finalname>    <Plugins>        <plugin>            <groupId>Org.eclipse.jetty</groupId>            <Artifactid>Jetty-maven-plugin</Artifactid>            <version>9.4.6.v20170531</version>            <executions>                <Execution>                    <Phase>Package</Phase>                    <Goals>                        <goal>Run</goal>                    </Goals>                </Execution>            </executions>        </plugin>    </Plugins></Build>

Building a Java Web project with Eclipse + Maven (iii)

Related Article

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.