我想运行gradle任务,为我生成原始文件中的java文件。这是我的代码:
task runJar(dependsOn: jar) << {
javaexec {
main = "-jar";
args = [
"wire-compiler-1.8.0-jar-with-dependencies.jar",
"--proto_path=src/main/proto",
"--java_out=build/generated/proto/wire test.proto"
]
}
}
通过命令行一切都很好,但在gradle中它不起作用。
java -jar wire-compiler-1.8.0-jar-with-dependencies.jar --proto_path=src/main/proto --java_out=build/generated/proto/wire test.proto
任何帮助表示感谢。
修改
我发现了问题。它应该是这样的:
task runJar(dependsOn: jar) << {
javaexec {
main = "-jar";
args = [
"wire-compiler-1.8.0-jar-with-dependencies.jar",
"--proto_path=src/main/proto",
"--java_out=build/generated/proto/wire",
"test.proto"
]
}
}