Skip to content

nativeRunAgent task do not support --args like the Application plugin’s run task #206

@ctoabidmaqbool

Description

@ctoabidmaqbool

When using the Gradle Application plugin, it is possible to pass arguments directly to the main(String[] args) method via the --args option:

./gradlew run --args="foo bar"

This works as expected: the arguments are forwarded to the application’s main method.

However, when using the GluonFX Gradle plugin, the analogous task nativeRunAgent do not support --args. For example:

./gradlew nativeRunAgent --args="foo bar"

The tasks execute, but the arguments are not passed to the application’s main(String[] args) method.

This makes nativeRunAgent inconsistent with the Application plugin’s run task, even though their purpose is very similar (running the app, with nativeRunAgent additionally generating/modifying GraalVM agent configs).


Expected Behavior

  • nativeRunAgent should accept --args and forward those arguments to the application’s main(String[] args), just like the Application plugin’s run task.

Actual Behavior

  • --args is ignored by nativeRunAgent.
  • The application receives no arguments in its main(String[] args).

Steps to Reproduce

  1. Create a simple JavaFX/Java app with a main(String[] args) that prints the arguments.
  2. Run with the Application plugin:
    ./gradlew run --args="foo bar"
    → Output shows foo bar.
  3. Run with GluonFX plugin:
    ./gradlew nativeRun --args="foo bar"
    → Output shows no arguments.

Question

Is there a supported way to pass arguments to main(String[] args) when using nativeRunAgent without modifying the plugin source?

If not, would it make sense to add --args support to these tasks, for consistency with the Application plugin?


Notes

  • I can work around this by modifying the plugin source (adding an @Option("args") property to NativeRunAgentTask and forward those args into the JavaExec task, but I’d prefer to know if there’s an official or simpler way.
  • Happy to provide a PR if this feature is not yet supported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions