Author Topic: gradle start with arguments --args should use = and not space  (Read 2563 times)

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
gradle start with arguments --args should use = and not space
« on: December 01, 2019, 06:57:46 PM »
When I do Debug->Start with arguments in a gradle project and enter "-l trace" as my arguments, I get an error:

Quote
No argument was provided for command-line option '--args'.

SlickEdit tries to run:

...\gradle.bat -b ...\build.gradle classname --debug-jvm --args "-l trace"

But after searching on the net, I found that it should be --args=, so it should be:

...\gradle.bat -b ...\build.gradle classname --debug-jvm --args="-l trace"

When I run with "--args=" from the command line (removing the --debug-jvm) it works properly. If I use the space, I get the same error message.

Related: Is there a way to perform "Execute with parameters", if I want to execute and not debug?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: gradle start with arguments --args should use = and not space
« Reply #1 on: December 02, 2019, 02:27:14 PM »
I can reproduce that.  It looks like we should have always used a '=' there since 5.x, but we didn't notice it because it manages to work when the first argument does not begin with "-".  I'll put in a hotfix for that.

Right now, the only way to do that is set the command line in the Gradle Options wizard.  It would be nice have a "Run with arguments..." entry too.

[edit: fixed mangled sentence]

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: gradle start with arguments --args should use = and not space
« Reply #2 on: December 02, 2019, 02:35:22 PM »
Thanks Patrick.

Yes it would be nice to have a "Run with arguments" as well.

If I wanted to embed arguments into a specific configuration, how could I do that?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: gradle start with arguments --args should use = and not space
« Reply #3 on: December 05, 2019, 09:56:46 PM »
This problem with --args is fixed in the next hotfix. 

Different project configurations can have different arguments associated with them, but that seems overkill to have to switch between project configurations.  An easier workaround for now would be to open the vpj file, and copy and rename the Execute target, so you can have a different target with different command line arguments.

rowbearto

  • Senior Community Member
  • Posts: 2335
  • Hero Points: 132
Re: gradle start with arguments --args should use = and not space
« Reply #4 on: December 06, 2019, 02:54:58 PM »
Patrick: Ok, but even with different execute targets, how would I specify the command line parameters in them?

For example, my execute target has:

Code: [Select]
task execute(type: JavaExec){
    classpath = sourceSets.main.runtimeClasspath
    main = "Main"
    args = System.getenv("SLICKEDIT_GRADLE_EXEC_ARGS")?.tokenize('\1')?: []
}

Where/how do I insert my custom arguments into that?