idea中maven web项目使用tomcat进行调试

案例使用的是servlet的一个简单的“hello maven!”.下面来介绍配置步骤

1.在pom.xml文件中配置tomcat插件,配置好的pom.xml文件如下:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>
    
    <groupId>edu.hohaigroupId>
    <artifactId>helloWorld_01artifactId>
    <version>1.0-SNAPSHOTversion>
    
    <packaging>warpackaging>
    
    <dependencies>
        <dependency>
            <groupId>javax.servletgroupId>
            <artifactId>servlet-apiartifactId>
            <version>2.5version>
            <scope>providedscope>
        dependency>
    dependencies>

    
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.mavengroupId>
                <artifactId>tomcat7-maven-pluginartifactId>
                <version>2.2version>
                <configuration>
                    
                    
                    
                    <path>/helloWorld_01path>
                configuration>
            plugin>
        plugins>
    build>
project>
2.配置tomcat运行/调试环境

idea中maven web项目使用tomcat进行调试_第1张图片

3.在项目中打断点,debug模式运行项目

idea中maven web项目使用tomcat进行调试_第2张图片

4.访问项目

idea中maven web项目使用tomcat进行调试_第3张图片
idea中maven web项目使用tomcat进行调试_第4张图片

你可能感兴趣的:(Maven)