redhat-developer / redhat-developer/vscode-java

[gradle] Accessing files in build directory

未关闭
#279 4 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Gradle upstream
主要语言
TypeScript
星标
2.3k
派生
546
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

[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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用相对 build.num 路径复现 Gradle 构建,并将其与 ${projectDir}/build.num 形式进行比较。检查 VS Code Java extension 如何启动 Gradle,并验证该修复会使相对路径从构建目录解析,同时不会破坏其他构建。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
build-system
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。