FibreFoX / javafx-gradle-plugin

Gradle plugin for JavaFX
Apache License 2.0
428 stars 59 forks source link

JVMArgs (and potentially other options) ignored when running via jfxRun #59

Open marckaraujo opened 7 years ago

marckaraujo commented 7 years ago

Hey @FibreFoX ,

Thanks for the help with the last issue, got it working, not a problem with your plugin. I am using JVMArgs like this:

jvmArgs = ["-agentlib:TakipiAgent"]

But it doesnt work.

If I run java -agentlib:TakipiAgent -jar project.jar in prompt it works.

FibreFoX commented 7 years ago

Can you check what will generated inside the .cfg-file?

marckaraujo commented 7 years ago

No, .cfg file has been created.

FibreFoX commented 7 years ago

build/jfx/native/{appname}/app/ should contain it ....

marckaraujo commented 7 years ago

When I run jfxNative it create .cfg and works well.

[JVMOptions]
-agentlib:TakipiAgent

But with jfxRun, it doesnt work.

FibreFoX commented 7 years ago

:D i think i get it now ... this is not how that feature works ... that options are not appended while calling jfxRun

FibreFoX commented 7 years ago

This is half bug and other half feature, because "jfxRun" was only ment as some "stupid shorthand" for running the application. Thanks for finding this ;) and using the plugin

FibreFoX commented 7 years ago

Hi @marckaraujo , can you try to add your parameters to jfx.runJavaParameter ? That one is one string and ment for debugging (like jfxRun is itself). I have thought about this, but I don't feel good about adding that lists to jfxRun, as the only purpose was to add a convenient way for executing. As the jvmArgs are ment for the final result and native launcher, I don't feel good about this.

How do you think about this, and is runJavaParameter sufficient for you?

marckaraujo commented 7 years ago

Its doesnt work for me, because tapiki need to launch with jvmArgs since it will monitor the application and send crash logs, of course that the most critical part is when you send the application to real users, this feature just help for local debug. The software in question is https://www.overops.com/

FibreFoX commented 7 years ago

Have you tried this configuration?

jfx{
    // used for native launchers
    jvmArgs = [
        '-agentlib:TakipiAgent'
    ]
    // used for development via jfxRun-task
    runJavaParameter = '-agentlib:TakipiAgent'
}
marckaraujo commented 7 years ago

I am not using this software anymore, so I cant make the test again, sorry. You can close if you want. Thanks anyway.

MartinEden commented 7 years ago

Possibly this should be a separate issue but I believe this underlying problem affects integration with IntelliJ IDEA.

When I tell IDEA to run with jfxRun task with debugging it runs the task correctly, but the debugger does not attach and breakpoints are not hit. I reported this to Jetbrains, and they suggest it's because the jfxRun task is ignoring JVM args passed through.

Is this likely? If so, it would be great to have a fix for this issue. Alternatively, can you suggest a way to debug JavaFX apps with your plugin and IDAE?

FibreFoX commented 7 years ago

@MartinEden the task jfxRun runs your application within its own java-process (I use ProcessBuilder for this), therefor I think this is a misunderstanding how the "debugging"-feature from your IDE is working.

The jfxRun was ment as a shortcut for the CLI-call, nothing more. This means that any JVM-args have to be set via runJavaParameter

mataide commented 6 years ago

@MartinEden Have you find a way to pass JVM args when debugging with IDE using this gradle plugin? Seems that this doesnt work: https://stackoverflow.com/questions/25079244/how-to-pass-jvm-options-from-bootrun/26141841#26141841

MartinEden commented 6 years ago

I've forgotten some of what was going on for me here but: I think I thought that the only way to run a Kotlin JavaFX app from IDEA was using the Gradle task. I think I then later found a way to directly invoke the debugger on my code without having to use jfxRun.