0

I want to start spring-boot maven application in debug mode in intellij Idea, but when I make breakpoints the application doesn't suspend and goes further. I've read a lot of topics but I still don't understand how to do it. Could you help me decide the best course of action.

Edit: I use spring-boot-maven-plugin and Maven Run/Debug configuration with spring-boot:run in command line.

Edit: So when I added Jvm Arguments to pom.xml I recieved such log:

[INFO] Scanning for projects...
[INFO]                                                                         

[INFO] ------------------------------------------------------------------------
[INFO] Building shop 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) > test-compile @ shop >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ shop ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ shop ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ shop ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Валера\IdeaProjects\shop\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ shop ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) < test-compile @ shop <<<
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.5.8.RELEASE:run (default-cli) @ shop ---
[INFO] Attaching agents: []
Listening for transport dt_socket at address: 5005

But when requesting localhost:5005/myPage I recieve Error 101 (net: : ERR_CONNECTION_RESET). Seems like some maven arguments did not specify.

Here my maven plagin in 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=5005 
                </jvmArguments>
            </configuration>
        </plugin>
    </plugins>
</build>
5
  • Are you sure that you have started application in debug mode? Nov 29, 2017 at 13:09
  • Do you use IDE run action or Maven goal to start the application?
    – y.bedrov
    Nov 29, 2017 at 13:12
  • Did you follow these instructions: docs.spring.io/spring-boot/docs/current/maven-plugin/examples/… ?
    – Tome
    Nov 29, 2017 at 13:48
  • requesting localhost:5005/myPage - do you mean attach the IDEA remote dubugger to localhost:5005? Do you need to debug via Maven? Can't you just debug by running the project in debug mode? Usually while developing, there is no need to build and run using Maven, since IDEs have a good integration.
    – helospark
    Nov 29, 2017 at 20:38
  • Yes, you're right. I want to do stuff like that. This is needed because when I make the breaks in Intellij my application doesn't stop on them. So I want to know more about that. Nov 30, 2017 at 6:54

2 Answers 2

1

In your Run/Debug Configurations enter the following into your command line:

spring-boot:run -Dspring.profiles.active=local,<mine> -Dfork=false -f pom.xml

My Maven spring-boot:run configuration debugs just fine with the -D fork=false added.

1
  • If you disable forking, spring boot wont auto reload if code is changed. Forking disables devtools , if I am not mistaken Aug 4, 2021 at 13:50
0

You may use below command in the CLI:

export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n

Below is my project settings:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.