It would be very helpful if we could easily remote debug AOT generated code directly from Maven/Gradle. Spring Native had: mvn spring-aot:generate -Dspring.aot.debug=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000.

Comment From: philwebb

Relevant (VMware only) doc https://docs.google.com/document/d/1SiP3_N1Hq8FztQw2qZjgyXqBsZpht_-itDfGH4_l2Yo/edit

Comment From: wilkinsona

With Gradle, generateAotSources is a JavaExec task so all of its configuration options are available. This means that you can do this:

tasks.named("generateAotSources").configure {
    jvmArgs "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000"
}

Or, if you prefer not to remember the agentlib:jdwp syntax:

tasks.named("generateAotSources").configure {
   debugOptions {
       enabled = true
       port = 8000
       server = true
       suspend = true
   }
}

Comment From: snicoll

And we already have that for Maven as well. jvmArguments can be used for this:

mvn spring-boot:aot-generate -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=y"

Have I missed something?

Comment From: wilkinsona

I think we missed that the run arguments could be used and they would affect spring-aot:generate. If it were a more user-facing need, I'd be in favour of a more intuitively named property. I think it's fine as it is.

Comment From: snicoll

FTR we discussed this some more and agreed we should do something about it. I've created #31682 for that.

Comment From: snicoll

Superseded by #31682