IDEA configures and runs maven web project

Keywords: Tomcat xml Maven JSP

I. Modification of project structure

1.1 The directory structure of the project just created in idea is not standard and needs to be changed manually.

Standard directory structure: https://blog.csdn.net/nothings0o/article/details/77122646

Modify the directory structure: https://blog.csdn.net/qq_34377273/article/details/83183307

Configuration of tomcat plug-in

2.1 Add to the <build> tag of the pom.xml file (there are many other plug-ins that can be deleted from the initial pom.xml)

<build>
    <plugins>
        <!--To configure tomcat-->
        <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.2</version>
          <configuration>
            <!-- control tomcat Port number -->
            <port>80</port>
            <!-- Project release to tomcat Name after -->
            <!-- / Equivalent to publishing a project with a name of ___________ ROOT -->
            <!-- /abc -->
            <path>/</path>
          </configuration>
        </plugin>
      </plugins>
  </build>

Configuration dependency packages

<dependencies>
  <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>javax.servlet.jsp</groupId>
    <artifactId>jsp-api</artifactId>
    <version>2.2</version>
    <scope>provided</scope>
  </dependency>
  <dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
  </dependency>
</dependencies>

3.1 Here I just randomly configure one, which to add, according to the situation.

3.2 Coordinate Search Website: https://mvnrepository.com/

IV. Operating Projects

4.1 The operation is shown in the figure.

 

 

4.2 tomcat plug-in details: https://my.oschina.net/lilw/blog/168667

 

Posted by canny on Tue, 30 Jul 2019 16:24:24 -0700