redhat-developer / redhat-developer/vscode-java

[gradle] Accessing files in build directory

Open
#279 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Gradle upstream
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

[provide a description of the issue]

Environment
  • Operating System: macOS Sierra
  • JDK version: JDK 8
  • Visual Studio Code version: 1.15
  • Java extension version: 0.8.0
Steps To Reproduce

I track a build number using a text file in the build project directory, e.g., 'build.num'

First, the file can't be found using this code:

def buildNumber = new File("build.num").text.toInteger() + 1

It looks like gradle isn't being run in the same directory as the build.gradle file. So I changed the code to this:

def buildNumber = new File("${projectDir}/build.num").text.toInteger() + 1

Now the 'build.num' file is being found. The same problem exists when referencing any files from a relative location.

Current Result

File Not Found

Expected Result

Build should work the same as if running it from the build directory.

Additional Informations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Gradle build with the relative build.num path and compare it with the ${projectDir}/build.num form. Inspect how the VS Code Java extension launches Gradle and verify that the fix makes relative paths resolve from the build directory without breaking other builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.