gradle 不通过扩展使用选项将参数传递给 gulp
gradle not passing args to gulp with extended use options
使用以下 Gradle gulp plugin ,它通过简单的命名约定 gulp_<task name>
从 gradle task
简单地执行 gulp task
在文档的扩展选项中:Gradle gulp plugin extended docs 它演示了以下内容:
task gulpBuildWithOpts(type: GulpTask) {
args = ["build", "arg1", "arg2"]
}
在我由 gradle 执行的标准构建任务中,如下所示:
// runs "gulp build" as part of your gradle build
bootRepackage.dependsOn gulpBuildWithOpts
task gulpBuildWithOpts(type: GulpTask) {
args = ["build", "--env prod", "--buildType gradle"]
}
执行并构建了以下内容,但是忽略了 args,gulp 从不拾取它们。参数应由 Yargs command line parser
处理
如果我 运行 直接使用 gulp(如下所示)那么这工作正常,那么为什么当 运行 来自 gradle?
gulp build --env dev --buildType gulp
注意 - 应用程序布局是 Springboot / AngularJS (^1.5) 如果您想知道工具的选择。
您需要单独传递这些选项:
task gulpBuildWithOpts(type: GulpTask) {
args = ["build", "--env", "prod", "--buildType", "gradle"]
}
否则 "--env prod"
被 yargs
解释为名为 env prod
的单个选项,而不是名为 env
且参数为 prod
的选项。
使用以下 Gradle gulp plugin ,它通过简单的命名约定 gulp_<task name>
gradle task
简单地执行 gulp task
在文档的扩展选项中:Gradle gulp plugin extended docs 它演示了以下内容:
task gulpBuildWithOpts(type: GulpTask) {
args = ["build", "arg1", "arg2"]
}
在我由 gradle 执行的标准构建任务中,如下所示:
// runs "gulp build" as part of your gradle build
bootRepackage.dependsOn gulpBuildWithOpts
task gulpBuildWithOpts(type: GulpTask) {
args = ["build", "--env prod", "--buildType gradle"]
}
执行并构建了以下内容,但是忽略了 args,gulp 从不拾取它们。参数应由 Yargs command line parser
处理如果我 运行 直接使用 gulp(如下所示)那么这工作正常,那么为什么当 运行 来自 gradle?
gulp build --env dev --buildType gulp
注意 - 应用程序布局是 Springboot / AngularJS (^1.5) 如果您想知道工具的选择。
您需要单独传递这些选项:
task gulpBuildWithOpts(type: GulpTask) {
args = ["build", "--env", "prod", "--buildType", "gradle"]
}
否则 "--env prod"
被 yargs
解释为名为 env prod
的单个选项,而不是名为 env
且参数为 prod
的选项。