Gradle Plugin Run/Debug Configuration - Where are the debug options defined?
Hello There,
i have Spring Boot Java application which can be build with gradle. I have imported my project in IntelliJ as gradle project.
I have defined in my build.gradle some applicationDefaultJvmArgs which are used when i start my gradle task via Run configuration
project.gradle.projectsEvaluated {
// Read spring profile from command line, Debug options
applicationDefaultJvmArgs = ["-Dspring.profiles.active=${project.gradle.startParameter.systemPropertiesArgs['spring.profiles.active']}", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9090"]
}
My Run/Debug Configuration has the following setup...
Name: runFoo
Single instance only: checked
Taks: run
VM options:
Script parameters: -Dspring.profiles.active=local
---
If i start the application in run mode...
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java
-Dspring.profiles.active=local
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9090
-Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant
is executed.
---
if i start in debug mode....
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java
-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=51378
-Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant
is executed.
Where are these "-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=51378" options defined? Is it coming as default from the gradle plugin? The address port change on every start. Where is the port defined? Where can I configure the options for debug mode?
Any help? Thanks for every hint.
Daniel
请先登录再写评论。
These debug options are generated by IDEA for each Gradle Run Configuration execution in debug mode.
Why do you want to override it?
Why you cant just use Gradle Debug Run Configuration?
Attachment(s):
spring-boot-run-debug.png
If i start my gradle project from command line i pass my spring profile configuration (local/dev/int/prod) via command line argument
gradlew run -Dspring.profiles.active=local
in IntelliJ for run mode this works fine, because it's the same like on command line.
If start it debug mode, maybe the command line argument is passed, but the jvm arguments are overwritten by "-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=51378".
So I try to understand if there is..
a) A way to configure "These debug options are generated by IDEA for each Gradle Run Configuration execution in debug mode."
b) or the possiblity to pass "-Dspring.profiles.active=local" to the call of /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java (I tried also to set the vm options, but with no effect)
For clarification, debugging in general works, but the IntelliJ mechanism is conflicting with the way i pass my vm argument.
Thanks for the clarification!
I created an issue for the problem, you can track the status at https://youtrack.jetbrains.com/issue/IDEA-138629