You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't use Eclipse and have no idea what 'Buildship' is.
The issue is that the Gradle build file is apparently being run from some
other directory then the one in which the file is located. So relative file
paths aren't being resolved. Just add this line to a working build.gradle:
def buildNumber = new File("build.num").text.toInteger() + 1
And make sure you have a file named 'build.num' in the same directory as
the build.gradle file, e.g., 'echo 1 > build.num'.
Yes, I realize this is an easy fix for the build.gradle writer. You can
replace that line with:
def buildNumber = new File("${projectDir}/build.num").text.toInteger() + 1
And what's more, it's better practice. I'm fixing my build.gradle files as
we speak. But the build.gradle file _should_ be run from the same directory
it's found in. The relative file approach works in other build tools
(IntelliJ IDEA, Bamboo, etc.).
So I managed to reproduce the issue with Eclipse, this is definitely an upstream issue in the Buildship project. My wild guess is this is caused by the gradle process running at the workspace level, not the project level. Unless @donat can provide guidance about how to fix it, if it's possible, we won't be able to change that behaviour.
@fbricon can you describe your understanding of the differences between "workspace" level and "project" level?
either way, i would agree with this theory, and reckon the cause of the issue is the java LS process cwd does not match the project dir.
i'd love to know if this is possible to fix in buildship, but I don't think you can configure a "custom cwd" via the gradle tooling api. i've written up some thoughts about supporting relative paths here microsoft/vscode-gradle#332 (comment) and would love some feedback.
Activity
fbricon commentedon Aug 24, 2017
Please provide a standalone project reproducing this issue.
Can you try the same steps in Eclipse with Buildship installed?
ctwise commentedon Aug 24, 2017
[-]Accessing files in build directory[/-][+][gradle] Accessing files in build directory[/+]fbricon commentedon Aug 25, 2017
So I managed to reproduce the issue with Eclipse, this is definitely an upstream issue in the Buildship project. My wild guess is this is caused by the gradle process running at the workspace level, not the project level. Unless @donat can provide guidance about how to fix it, if it's possible, we won't be able to change that behaviour.
badsyntax commentedon May 5, 2020
@fbricon can you describe your understanding of the differences between "workspace" level and "project" level?
either way, i would agree with this theory, and reckon the cause of the issue is the java LS process
cwddoes not match the project dir.i'd love to know if this is possible to fix in buildship, but I don't think you can configure a "custom cwd" via the gradle tooling api. i've written up some thoughts about supporting relative paths here microsoft/vscode-gradle#332 (comment) and would love some feedback.
robstryker commentedon Oct 28, 2026
This issue seems to be an upstream issue. See microsoft/vscode-gradle#245
Closing this issue now.