Open roberterdin opened 9 years ago
there is only this condition:
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
return executorId.equals(RunVisualVMExecutor.RUN_WITH_VISUAL_VM)
&& profile instanceof ModuleRunProfile
&& !(profile instanceof RemoteConfiguration);
}
What kind of Run Configuration are you using?
I execute a gradle task as Run Configuration:
cleanTest test --tests SomeTest
I guess I need a JAR Applicatoin?
Yep, JUnit/TestNG/Application...
I will look into it, but not even YourKit buttons are enabled for gradle...
Ok thank you. Don't worry too much about Gradle support... if somebedy wants to profile something he will manage to make an according Run Configuration :)
I just tried it, and it does not seem possible without some heavy hacks, since Gradle uses deamons.
At least for Unit Tests, yes. AFAIK (have not veryfied this) it starts the application without a daemon.
task execute(type:JavaExec) {
main = mainClass
classpath = sourceSets.main.runtimeClasspath
}
this uses the deamon too.
It is possible to run it as a Groovy task, then it will run in its own process with the visualvm.id correctly set and with working buttons, however that is a wrapper too (org.gradle.launcher.GradleMain) and forks another process in which the app is running, and it cannot be debugged this way - Maven does something similar and the process forking can be disabled, so perhaps this too can be configured...
There must be some way how to pass a VM parameter via the deamon to the forked processes...
The gradle run task from the Application Plugin runs my application in a seperate process. It sais it uses the JavaExec function. This function also takes VM args.
Example:
// File: build.gradle
apply plugin: 'java'
task(runSimple, dependsOn: 'classes', type: JavaExec) {
main = 'com.mrhaki.java.Simple'
classpath = sourceSets.main.runtimeClasspath
args 'mrhaki'
jvmArgs "-DsomeArg=xx", "-Danother=yy"
systemProperty 'simple.message', 'Hello '
}
Source: http://mrhaki.blogspot.com/2010/09/gradle-goodness-run-java-application.html
edit: did not read your answer correctly, discard what I just wrote
I have the same issue! After I installed and configured Visual VM Launcher and restarted the Intellij IDEA 2021.3.3 I can see that icons are greyed out as shown on the screenshot below.
Icons are also greyed out even in "Run" menu as you can see on the screenshot below:
-My project uses the same jdk as shown in the plugin configuration; -My project starts with gradle task (look at the screenshot below).
Can you help me with this problem?
@krasa I think I have found the root cause of this problem - it is all about configuration type:
Icons are grayed out for Gradle
configurations:
Icons are active for JUnit
configurations:
You can also observe similar behavior when launching tests from IntelliJ IDEA
No Icons for Gradle
configurations:
Icons are visible for JUnit
configurations:
Action
It looks like this Plugin needs some changes because the Gradle
configuration is the default way of running tests nowadays:
Changing Default test configuration This option allows us to determine which configuration will be created while running tests from the IntelliJ IDEA.
The VisualVM icons are greyed out. I specified the executable (
/usr/lib/jvm/java-8-oracle/bin/jvisualvm
, that is on Ubuntu) but nothing happens. I can run the VisualVM from the terminal without problems.Any ideas where to start troubleshooting?
IDEA version: 14.1