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
Description
I have an ant taskdef that retrieves some git information and I am executing it from a gradle task. When I run the task from a bash console, I get the correct output, but when I run it from the vscode-gradle tasks extension, I get an error from git. Error: fatal: not a git repository (or any of the parent directories): .git
I have added logging to the ant taskdef class, before the git command is executed, and I can see that the vscode-gradle extension is executing the ant task from the .gradle/daemon/6.7/ in my home folder instead of the project folder.
vscode-gradle: Current Working Dir: /Users/roger/.gradle/daemon/6.7/
Command line: Current Working Dir: /Users/roger/path/to/project/
To Reproduce
Create an class that extends org.apache.tools.ant.Task and have that class log the current working directory.
Create a gradle task that uses the ant task.
Execute the task from the vscode-gradle tasks list.
it should print out the Gradle User Home path instead of the project path
Executing the same task from the command line prints out the project path.
Expected behavior
The ant task should execute from the project directory
Does the bug still exist if you disable all other extensions?
not tested
The text was updated successfully, but these errors were encountered:
The problem is that I can't change the gradle working directory, so gradle will inherit the working directory from the java process that calls the gradle api.
So one potential fix, as shown in the PR above, is to set the working directory to the project directory when starting the gradle server. This will fix all relative path issues, but presents some problems for multi-root workspaces (eg, which project root do i start the server in? should i start one server for each multi-root project?)
I just need to think about the best approach for multi-root workspaces and then i'll add a fix for this.
Although your case seems a little different, i'm surprised the working directory is /Users/roger/.gradle/daemon/6.7/. Either way, I will fix the gradle server cwd issue and we'll see if that resolves it for you.
Extension Name: vscode-gradle
Extension Version: 3.5.2
OS Version: MacOS 10.15.7
VSCode version: 1.5.2
Description
I have an ant taskdef that retrieves some git information and I am executing it from a gradle task. When I run the task from a bash console, I get the correct output, but when I run it from the vscode-gradle tasks extension, I get an error from git.
Error: fatal: not a git repository (or any of the parent directories): .git
I have added logging to the ant taskdef class, before the git command is executed, and I can see that the vscode-gradle extension is executing the ant task from the .gradle/daemon/6.7/ in my home folder instead of the project folder.
vscode-gradle: Current Working Dir: /Users/roger/.gradle/daemon/6.7/
Command line: Current Working Dir: /Users/roger/path/to/project/
To Reproduce
Create an class that extends org.apache.tools.ant.Task and have that class log the current working directory.
Create a gradle task that uses the ant task.
Execute the task from the vscode-gradle tasks list.
it should print out the Gradle User Home path instead of the project path
Executing the same task from the command line prints out the project path.
Expected behavior
The ant task should execute from the project directory
Does the bug still exist if you disable all other extensions?
not tested
The text was updated successfully, but these errors were encountered: