maven命令起工程(mvns pring-boot:run)如何进行debug调试

项目运行是通过maven

clean package spring-boot:run -Dmaven.test.skip=true

首先在pom.xml文件中配置一下:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <jvmArguments>
                -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8080
                </jvmArguments>
            </configuration>
        </plugin>
    </plugins>
</build>

把项目run起来以后,就会在最下方看到:

Listening for transport dt_socket at address: 8088

说明正在监听我们前面配置的8088端口。

我们需要配置一个Remote来进行Debug,如下图: 

改下Name,和Port值即可,其它默认。我这里就叫boot-debug,Port就是之前pom里设置的address值。

这时我们再以Debug模式运行设置好的boot-debug。

Connected to the target VM, address: 'localhost:8088', transport: 'socket'  
说明debug连接上了之前监听的端口。

猜你喜欢

转载自blog.csdn.net/feicongcong/article/details/80510183