remote debugging of springboot in idea

Springboot official documentation: https://docs.spring.io/spring-boot/docs/1.1.x/maven-plugin/examples/run-debug.htmlPopular
science: Why remote debugging?
When our project was deployed to a remote server, an error occurred and we could only print the log to view the error message. The role of remote debugging is that you can debug your project locally. Is it practical? It means that your remote server publishes a project. When publishing, you need to bring some parameters, and then you can locally configure the IP and port number of the remote server in idea, and then debug the local project to control your server project Too.
Note: Only debugging, modification does not work. Also, the code must be consistent! ! ! ! !

First configure in maven

Note that address = 5005 refers to the listening port you exposed. This is the port that your idea connects to. Arbitrary designation

<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=5005
                    </jvmArguments>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

Then use maven plugin to package into jar file. Published in cmd command line
Note: The address number must be consistent and maven. Because if you don't write it, jvm will automatically create a port for you. As you can see on the command line, what is the address above? ? ? ? ? I do n’t know how to lie in a pom configured like this anyway. These are all my personal test. Rest assured.

java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=n -jar SeeyonCloud-Weather.jar

After the project is successfully launched. Start with idea
Figure
Add to configure a remote call. Fill in the port number and ip. This port number is what I said above. If you don't bring the address when you start it, it will automatically create one for you. Here you should fill port 5005
Write a picture description here
to start a successful screen
Write a picture description here
and then start the remote service on the line.
You will find that although you publish the project on the command line, the interruption point in the idea can be intercepted. Not awesome—–

I am curious about the modification after ten minutes

Just tested it, it can be configured without pom. It is convenient to add parameters when starting directly.

Published 281 original articles · 50 praises · 450,000 views +

Guess you like

Origin blog.csdn.net/lzh657083979/article/details/79597139