如何使用gradle修补java文件?

如何使用gradle修补java文件?,gradle,Gradle,我不能用gradle修补文件。我尝试使用ant,但始终出现错误: Execution failed for task ':rbps-api:compileJava'. > java.io.IOException: Cannot run program "patch" (in directory "C:\Users\IdeaProjects\cosmos\rbps-api"): CreateProcess error=2, The system cannot find the file sp

我不能用gradle修补文件。我尝试使用ant,但始终出现错误:

Execution failed for task ':rbps-api:compileJava'.
> java.io.IOException: Cannot run program "patch" (in directory "C:\Users\IdeaProjects\cosmos\rbps-api"): CreateProcess error=2, The system cannot find the file specified
渐变调试:

11:31:46.535 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
11:31:46.536 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:31:46.536 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
11:31:46.536 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file 'C:\Users\oleh.havryliv\IdeaProjects\cosmos\rbps-api\build.gradle' line: 56
11:31:46.536 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:31:46.536 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
11:31:46.537 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':rbps-api:assemble'.
11:31:46.537 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > java.io.IOException: Cannot run program "patch" (in directory "C:\Users\oleh.havryliv\IdeaProjects\cosmos\rbps-api"): CreateProcess error=2, The system cannot find the file specified
11:31:46.537 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:31:46.537 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
11:31:46.538 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.  Run with --scan to get full insights.
11:31:46.538 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
11:31:46.538 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
11:31:46.538 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
11:31:46.539 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 5s
gradle.xml

apply plugin: 'java'

    compileJava.doLast {
            ant.patch(patchfile: "$rootDir\\rbps-api\\ResourceBundle.patch" , originalFile: "$rootDir\\rbps-api\\src\\main\\java\\com\\medtronic\\diabetes\\carelink\\rbps\\api\\resource\\ResourceBundle.java")
        }

这些路径上存在文件。有什么不对劲吗?可能存在另一种方法?

正如Jeff Holt在评论中提到的:
补丁
Ant任务“需要
补丁
在执行路径上”(cf.)。

我认为错误是gradle找不到
补丁
可执行文件。在gradle想要执行它的时候,它不在你的路径上。如果在gradle命令行上指定--debug标志,您可能会得到更多详细信息。@Jeff Holt,debug没有帮助显示PATH环境变量的值,然后在每个装入的磁盘上显示PATCH.EXE的所有实例。我需要手动安装补丁吗?我以为格拉德尔的引擎盖下有补丁…是的。格拉德尔和蚂蚁都没有补丁。但ant有一个任务定义,允许您在安装了补丁的情况下执行补丁。