How to attach VisualVM to an application launched through Gradle?

If I launch a desktop application from the command-line, or via Eclipse, it automatically appears in a list in VisualVM that then allows me to connect & profile it.

If however I run the same application via gradlew run (using the “application” plugin) it does not.

Can anyone share a secret incantation that will make this work?