Program arguments with spaces


(Ed R) #1

I’m trying to pass in parameters to tasks using program arguments through the Eclipse Buildship plugin and can’t seem to get it to accept program arguments with spaces. I’ve tried enclosing with quotes which works fine via the command line, but doesn’t seem to work with Buildship. It sees the space and interprets what comes next as a task. Is there another way to enclose program argument values to include spaces?

Buildship: 2.2.0
Gradle: 4.4
Java: 1.8.0_121

An example of trying to enclose with quotes through the Buildship plugin…


Gradle Distribution: Specific Gradle version 4.4
Gradle Version: 4.4
Java Home: C:\Program Files\Java\jdk1.8.0_121
JVM Arguments: None
Program Arguments: -PwebDriver=chrome -PappEnv=DEVELOPMENT -PappVersion="Version no : 005.014"
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: test

webDriver: chrome
appVersion: "Version

FAILURE: Build failed with an exception.

  • What went wrong:
    Task ‘no’ not found in root project ‘MyProject’.

And running from the command line…

C:\MyProject>gradlew build -PwebDriver=chrome -PappEnv=DEVELOPMENT -PappVersion="Version no : 005.014"
webDriver: chrome
appVersion: Version no : 005.014
:compileJava UP-TO-DATE

(Donát Csikós) #2

Your report is correct, Buildship at this moment can’t handle spaces in the arguments. I’ve opened a bug report for that.

It is only the UI that doesn’t let you do that. So, for the time being, you can work around that as follows:

  • on the common tab save the run config to a shared file.

  • then edit the argument list within the file. It will look something like this
<listAttribute key="arguments">
<listEntry value="-Pfoo=bar baz"/>