如何在 Gradle 任务中运行终端命令?



我有以下任务:

task installMavenLocal(type: Upload) {
description "Installs the artifacts to the local Maven repository."
configuration = configurations['archives']
repositories {
mavenDeployer {
repository url: repositories.mavenLocal().url
}
}
}

当我运行我的 Gradle 命令时,我会执行以下gradle installMavenLocal -x:test:packageRelease,有没有办法将该命令添加到我的上述任务中,以便开发人员无需添加-x:test:packageRelease,它只是在我执行任务时运行?

您可以使用:

installMavenLocal.dependsOn.remove(tasks.getByPath(":test:packageRelease"))

最新更新