Skip to content

Project cannot be synced when gradle init script path contains white spaces #2692

@tthornton3-chwy

Description

@tthornton3-chwy

Good evening vscode-java team! Hope all is well.
When I set generatesMetadataFilesAtProjectRoot to true and refresh the project, org.eclipse.buildship.core.prefs gets updated to include arguments=--init-script /Users/[...me]/Library/Application Support/Code - Insiders/User/globalStorage/redhat.java[...], etc. These scripts seem to be injecting some plugins and doing some setup stuff, which is totally cool, and things seem okay until the next time I rebuild (like by editing+saving the gradle file).

Due to the spaces in the path, the first one being in Application Support, I get an error:
[Error - 7:15:04 PM] Sep 24, 2022, 7:15:04 PM Error occured while building workspace. Details: message: Could not run phased build action using connection to Gradle distribution '[...]/gradle-7.5.1-bin.zip'. The specified initialization script '/Users/[...me]/Library/Application' does not exist.; code: 0; resource: /Users/[...me]/Documents/[...project-path]/build.gradle;

I am able to work around this issue by either:

  1. removing the arguments line temporarily, re-saving the build.gradle file, and watch as it builds successfully.
  2. a bit more severe, but by using the --user-data-dir /Users/[...me]/.vscode-insiders/user-data flag applied to VS Code itself, the path that gets set for arguments is now a valid one!

Notes:

  • I tried every combination of quotes, escape characters, etc to get [...]/Application Support[...] to work and nothing would fix it. It just would not allow a path with a space in it.
  • I didn't try it, but maybe another work around could be a settings/option to turn on that has it instead use a local (to the .settings folder) init gradle script that calls those other init scripts within it.
  • (user directory name redacted in all references to [...me])
Environment
  • Operating System: MacOS 12.6
  • JDK version: 17.0.3
  • Visual Studio Code version: 1.72.0-insider
  • Java extension version: v1.11.2022092404
Steps To Reproduce
  1. Be on a mac
  2. Turn on thegeneratesMetadataFilesAtProjectRoot setting.
  3. Refresh the project, and watch as the org.eclipse.buildship.core.prefs file gets the described arguments line.
  4. Try to save the build.gradle file (automatic updating is turned on), and see it fail.

You may use https://spring.io/guides/gs/gradle/ w/ the "complete" project as a base hello world project. It just needs a gradle update to 7.3.X, which you all nicely tell us to do/help us through on open.

log.txt

Current Result

Project won't build on build.gradle save due to inappropriate init scripts locations (no quotes around a spaced location)

Expected Result

Project builds under those circumstances.

Additional Informations

Provided upon request.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions