This message was deleted.
# community-support
s
This message was deleted.
a
this is in my container:
and this is from my local machine (using intellij)
I need my app to start, and whenever I want to click on my IDE to debug the code, then it will attach to it
but I had no success, I've spent a lot of hours
since yesterday and today I'm trying
v
The Gradle task is not for productive run, but for testing, so you shouldn't use it for productive run anyway
a
Hi
I don't it's only for dev env.
but I couldn't make it work with
suspend=n
it only works with
gradle bootRun --debug-jvm
I did not have success with other options
v
Why? How did you try with suspend no?
a
I can list my tries here
one moment it's difficult to read
I put them in my notepad
all of these that I've paste, they don't stop on my breakpoint
v
All the things you list (from a cursory look) are for debugging Gradle itself, not your project. Configure the
debugOptions
on the
bootRun
task in your build script
👍 1
a
I don't want to change something in the project as I'm new to the company, and there is a team that is working, maybe I will need their approval
I need only from the command line if this is possible
I have aprox. 3 weeks in the company, and I'm creating a local dev environment for our team, as the current one is using aws, terraform, ...etc
I brought
devspace
project (https://www.devspace.sh) and I've built a lot of things, what it remained is to make gradle to accespt debugging (with
suspend=n
) so we can attach to the process at any time from our local machine
and I will need to find a way when there is some change in the code to hot reload the project using gradle
is
debugOptions
is the only solution that needs to be created as gradle
task
?
so there is no solution to provide it in the command line?
v
You can write an init script that changes the task configuration to your liking and supply that from command line.
👍 1
a
ok I will see how to do it. thanks for the hint
in build.gradle (in my container) I've defined this snippet of code and it worked
Copy code
tasks.register('configureBootRunJvmArgs') {
    doLast {
       tasks.bootRun.jvmArgs('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005')
    }
}

bootRun.dependsOn(configureBootRunJvmArgs)
the spring boot will run, it will not wait for me to click the debug button from the intellij ide, but whenever I set a breakpoint and send a request, it will stop at the breakpoint
thank you @Vampire
v
Why do you follow that bad practice and even without any reason?
Just directly configure the
bootRun
task.
There is no reason at all to have a separate task that manipulates another task at execution time.
And if you ever hope to use configuration cache this is not even possible anymore
a
I'm new to gradle, I don't know a lot about the best practices
also I'm under time pressure
v
Just configure the task directly
a
so this will work:
bootRun.jvmArgs('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005')
?
v
Copy code
tasks.named('bootRun') {
    jvmArgs('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005')
}
Would be better due to task configuration avoidance, but yes
👍 1
a
ok, I will use yours
👌 1
Copy code
tasks.named('bootRun') {
    jvmArgs('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005')
}
thank you