preface

In the past, when we debug web projects, we need to download a Tomcat locally. In order to reuse the project and facilitate others to quickly debug, here demonstrates a method of using Maven plug-in to start web projects

Add the following plug-ins to the POM file

<plugins>
    <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.2</version>
        <configuration>
            <port>8080</port>
            <path>/</path>
            <uriEncoding>UTF-8</uriEncoding>
            <server>tomcat7</server>
        </configuration>
    </plugin>
</plugins>
Copy the code

Ports, items, and paths can all be configured

Run the following command to start the service

mvn tomcat7:run
Copy the code

Or click the Plugin button in Maven in the IDEA sidebar

debugging

It is not possible to debug the source code in the above way, so you can simply configure it.

1. Click Edit Congigurations

2. Click the Maven button

3. Select the project to be executed and run the tomcat7:run command

Welcome to attention