0
votes

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>
2
Are you sure that you have started application in debug mode? - Pavle Eftimovski
Do you use IDE run action or Maven goal to start the application? - y.bedrov
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
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. - Valeriy Fedosov

2 Answers

1
votes

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.

0
votes

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