Program arguments with spaces

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

1 Like

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"/>

Is this issue solved?
Currently in command line using gradle 5.3.1, i am able to run this successfully
gradlew.bat bootRun --args="–spring.main.banner-mode=log --data.server=remoteHost:999"

But when I try running in spring tool suite 4 , I configure the same in the Run Configuration, I got error. So up to now, buildship still can’t handle spaces in the arguments?

This has been fixed in the latest Buildship snapshot. Can you please give it a try and provide us feedback?